}
}
- /// Only used by the IL of xaml, will never changed to not hidden.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool IsCreateByXaml
+ internal override bool IsBinded
{
get
{
- return base.IsCreateByXaml;
+ return base.IsBinded;
}
set
{
- base.IsCreateByXaml = value;
+ base.IsBinded = value;
if (value == true)
{
- this.TextChanged += (obj, e) =>
- {
- this.Text = e.TextEditor.Text;
- };
+ TextChanged += TextEditorTextChanged;
+ }
+ else
+ {
+ TextChanged -= TextEditorTextChanged;
}
}
}
+ private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
+ {
+ ForceNotifyBindedInstance(TextProperty);
+ }
+
/// <summary>
/// The FontSizeScale property. <br />
/// The default value is 1.0. <br />
}
}
+ if (IsBinded)
+ {
+ TextChanged -= TextEditorTextChanged;
+ }
+
base.Dispose(type);
}
}
}
- /// Only used by the IL of xaml, will never changed to not hidden.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool IsCreateByXaml
+ internal override bool IsBinded
{
get
{
- return base.IsCreateByXaml;
+ return base.IsBinded;
}
set
{
- base.IsCreateByXaml = value;
+ base.IsBinded = value;
if (value == true)
{
- this.TextChanged += (obj, e) =>
- {
- this.Text = e.TextField.Text;
- };
+ TextChanged += TextEditorTextChanged;
+ }
+ else
+ {
+ TextChanged -= TextEditorTextChanged;
}
}
}
+ private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
+ {
+ ForceNotifyBindedInstance(TextProperty);
+ }
+
/// <summary>
/// Get the InputMethodContext instance.
/// </summary>
}
}
+ if (IsBinded)
+ {
+ TextChanged -= TextEditorTextChanged;
+ }
+
base.Dispose(type);
}
SetBinding(targetProperty, binding, false);
}
- private bool isCreateByXaml = false;
/// Only used by the IL of xaml, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
- public virtual bool IsCreateByXaml
+ public bool IsCreateByXaml
{
- get
- {
- return isCreateByXaml;
- }
- set
- {
- isCreateByXaml = value;
- }
+ get;
+ set;
}
/// <summary>
}
}
+ /// This will be public opened in next ACR.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ForceNotifyBindedInstance(BindableProperty property)
+ {
+ if (null != property)
+ {
+ BindablePropertyContext context = GetOrCreateContext(property);
+
+ if (null != context?.Binding)
+ {
+ applying = true;
+ context.Binding.Apply(true);
+ applying = false;
+ }
+
+ OnPropertyChanged(property.PropertyName);
+
+ PropertyToGroup.TryGetValue(property, out HashSet<BindableProperty> propertyGroup);
+
+ if (null != propertyGroup)
+ {
+ foreach (var relativeProperty in propertyGroup)
+ {
+ if (relativeProperty != property)
+ {
+ var relativeContext = GetOrCreateContext(relativeProperty);
+ var relativeBinding = relativeContext.Binding;
+
+ if (null != relativeBinding)
+ {
+ applying = true;
+ relativeBinding.Apply(true);
+ applying = false;
+ }
+
+ OnPropertyChanged(relativeProperty.PropertyName);
+ }
+ }
+ }
+ }
+ }
+
/// <summary>
/// Sets the value of the propertyKey.
/// </summary>
}
}
- internal bool IsBinded
+ internal virtual bool IsBinded
{
get;
set;