KarelPrdel
KarelPrdel

Reputation: 99

Xceed ColorPicker - SelectedColor property doesn't update

I have this xceed color picker in my view called NewWindow:

<xctk:ColorPicker Name="ColorPicker"  SelectedColor="{Binding BackColor,  
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="1" Margin="15 0"></xctk:ColorPicker>

bound to this property in my viewmodel class called NewViewModel

public Color? BackColor { get { return _backColor; } set//BREAKPOINT// { SetProperty(ref _backColor, value, _backColorPropertyChangedEventArgs); } }

the problem is that the breakpoint is never reached and the BackColor value stays null. My other properties bound to other controls are working fine.

Code behind:

public NewWindow(ViewModel viewModel)
    {
        this.viewModel = viewModel;
        InitializeComponent();
        newViewModel=new NewViewModel();
        this.DataContext = newViewModel;
    }

I don't set the DataContext on any other place in my code.

Upvotes: 0

Views: 621

Answers (1)

KarelPrdel
KarelPrdel

Reputation: 99

Thanks for telling me about Snoop, it found, that the SelectedValue of ColorPicker is of type System.Windows.Media.Color and my Property was of type System.Drawing.Color

Upvotes: 3

Related Questions