Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Bind the DependencyProperty of a Class Derived from DependenyObject in WPF?
    text
    copied!<p>Im having a control named <strong><em>MyControl</em></strong> which contains a Collection&lt;<strong><em>MyClass</em></strong>> named <strong><em>MyClasses</em></strong> </p> <pre><code> &lt;MyControl&gt; &lt;MyClasses&gt; &lt;MyClasss Value={Binding} /&gt; &lt;/MyClasses&gt; &lt;/MyControl&gt; </code></pre> <p><strong><code>MyClass</code></strong> that is derived from <code>DependencyObject</code></p> <pre><code> Public Class MyClass : DependencyObject,INotifyPropertyChanged { Value //propdp (DependencyProperty) } </code></pre> <p>Im having a <code>DataTable</code>. I need to bind the data present in table[0][0] with the Value Property of <strong>MyClass</strong></p> <pre><code> Binding valuebinding = new Binding(); valuebinding.Path = new PropertyPath("ItemArray[0]"); valuebinding.Source = Table.Rows[0]; valuebinding.Mode = BindingMode.TwoWay; BindingOperations.SetBinding(myValue, MyClass.ValueProperty, valuebinding); BindingOperations.SetBinding(textBlock, TextBlock.TextProperty, valuebinding); </code></pre> <p>Now i need to dynamically change the value of the data present in the data table ? is there issue in it? whether the solution related to the below reasons?</p> <ol> <li>The DependencyObject class overrides and seals the Equals() and GetHashCode() methods</li> <li>DependencyObjects are not marked as serializable</li> <li>DependencyObject has thread affinity – it can only be accessed on the thread on which it was created</li> </ol> <p><strong>NOTE: It works fine in Silverlight</strong></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