Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF dependency property not recognized
    text
    copied!<p>I'm trying to overcome a limitation that doesn't allow me to bind to regular clr properties.</p> <p>The solution I use uses custom dependency properties that in turn changes clr properties.</p> <p>Here is the code</p> <pre><code>class BindableTextBox : TextBox { public static readonly DependencyProperty BoundSelectionStartProperty = DependencyProperty.Register("BoundSelctionStart", typeof(int), typeof(BindableTextBox), new PropertyMetadata(new PropertyChangedCallback(BindableTextBox.onBoundSelectionStartChanged))); private static void onBoundSelectionStartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((TextBox)d).SelectionStart = (int)e.NewValue; } private static readonly DependencyProperty BoundSelectionLenghtProperty = DependencyProperty.Register("BoundSelectionLenght", typeof(int), typeof(BindableTextBox), new PropertyMetadata(new PropertyChangedCallback(BindableTextBox.onBoundSelectionLenghtChanged))); private static void onBoundSelectionLenghtChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((TextBox)d).SelectionLength = (int)e.NewValue; } public int BoundSelectionStart { get { return (int)GetValue(BoundSelectionStartProperty); } set { SetValue(BoundSelectionStartProperty, value); } } public int BoundSelectionLenght { get { return (int)GetValue(BoundSelectionLenghtProperty); } set { SetValue(BoundSelectionLenghtProperty, value); } } } </code></pre> <p>But when I try to bound something to BoundSelectionStart it says it says that I can only bind to DP.</p> <pre><code>&lt;bindable:BindableTextBox Text="{Binding Name}" BoundSelectionStart="{Binding ElementName=slider1, Path=Value}" /&gt; </code></pre> <p>What is the problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload