Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: ColorPicker Binding

$
0
0
Hi,

your property Test need to be
A) a DP defined like this :
    public static readonly DependencyProperty TestProperty =
      DependencyProperty.Register( "Test",
      typeof( Color ),
      typeof( MainWindow ),
      new FrameworkPropertyMetadata( null ) );

    public Color Test
    {
      get
      {
        return ( Color )this.GetValue( MainWindow.TestProperty );
      }
      set
      {
        this.SetValue( MainWindow.TestProperty, value );
      }
    }
or
B) MainWindow should be INotifyPropertyChanged like this :
 public partial class MainWindow : Window, INotifyPropertyChanged
  {
    public Color Test
    {
      get
      {
        return m_test;
      }
      set
      {
        m_test = value;
        OnPropertyChanged( "Test" );
      }
    }

    private Color m_test;

    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged( string propertyName )
    {
      if( PropertyChanged != null )
      {
        PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
      }
    }
}

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>