Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ColorPicker > RadColorPaletteView SelectedColor ?

Not answered RadColorPaletteView SelectedColor ?

Feed from this thread
  • Daniel Ruehle avatar

    Posted on Jul 8, 2010 (permalink)

    Hello telerikTeam,

    I have an Issue with the SelectedColor in the RadColorPaletteView namely how can I get selectedColor ?
    If I try this:

    RadColorPaletteView colorPalette = sender as RadColorPaletteView;
     
    RadColorPaletteViewItem selectedItem = colorPalette.SelectedItem;

    I am getting null.

    Could you please tell me what I am doing wrong ?

    XAML
    <telerik:RadColorPaletteView x:Name="BorderColor" Margin="0" Grid.Column="1" Palette="Standard" PaletteOrientation="Horizontal" Style="{StaticResource RadColorPaletteViewStyle}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="ChangeColor"/>




    Thank you.

    Daniel

    Reply

  • Daniel Ruehle avatar

    Posted on Jul 8, 2010 (permalink)

    Hello,

    I found out. I used just a wrong event Handler. But how can I access SelectedPalleteViewItem Property ?

    BR,
    Daniel

    Reply

  • Viktor Tsvetkov Viktor Tsvetkov admin's avatar

    Posted on Jul 13, 2010 (permalink)

    Hello Daniel,

    What exactly do you mean by saying "access the SelectedPalleteViewItem property". The reason why I am asking is because RadColorPaletteView does not contain a property called SelectedPalleteViewItem. It has a SelectedItem property which is of type Color. To access it, you can subscribe for the SelectionChanged event of RadColorPaletteView and obtain the selected color from there:

    <telerik:RadColorPaletteView x:Name="BorderColor" Margin="0" Grid.Column="1"
            Palette="Standard" PaletteOrientation="Horizontal" VerticalAlignment="Center"
            SelectionChanged="ChangeColor" />

    private void ChangeColor(object sender, SelectionChangedEventArgs e)
    {
        if (BorderColor.SelectedItem != null)
        {
            MessageBox.Show(((Color)BorderColor.SelectedItem).ToString());
        }
    }

    I'm attaching my sample project for reference. Have a look at it and let me know how I can be of further assistance.

    All the best,
    Viktor Tsvetkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ColorPicker > RadColorPaletteView SelectedColor ?
Related resources for "RadColorPaletteView SelectedColor ?"

WPF ColorPicker Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]