RadColorPaletteView SelectedColor ?

3 posts, 0 answers
  1. Daniel Ruehle
    Daniel Ruehle avatar
    19 posts
    Member since:
    May 2010

    Posted 08 Jul 2010 Link to this post

    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
  2. Daniel Ruehle
    Daniel Ruehle avatar
    19 posts
    Member since:
    May 2010

    Posted 08 Jul 2010 Link to this post

    Hello,

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

    BR,
    Daniel
  3. UI for WPF is Visual Studio 2017 Ready
  4. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 13 Jul 2010 Link to this post

    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
Back to Top