This is a migrated thread and some comments may be shown as answers.

clear selectedcolor

3 Answers 109 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Aurore
Top achievements
Rank 1
Aurore asked on 30 Nov 2011, 05:40 PM
hello,

I use a colorselector in a raddropdownbutton (on a ribbon), to select color for several objects.
i have a framework as described bellow.

I'd like that each time i click on "color" button, the selectedcolor is empty.
because i need to be able to apply the same color for different objects, and sometimes user doesn't select all at one time, but select one defines a color, the selects another object and want to define same color. then he needs to change color selection, then reopen colorselector to choose right color.

<Window x:Class="tlk_colorpicker.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <tlk:RadDropDownButton Content="Color"  x:Name="color">
            <tlk:RadDropDownButton.DropDownContent>
                <tlk:RadColorSelector  SelectedColorChanged="PredefSelectedColorChanged"    NoColorVisibility="Collapsed" />
            </tlk:RadDropDownButton.DropDownContent>
        </tlk:RadDropDownButton>
         
        <Rectangle x:Name="oRect" Width="50" Height="50" Grid.Row="2"  Fill="AliceBlue" />
    </Grid>
</Window>
private void PredefSelectedColorChanged(object sender, EventArgs e)
        {
            oRect.Fill = new SolidColorBrush(((RadColorSelector)sender).SelectedColor);
            color.IsOpen = false;
        }

thanks for your expertise
Aurore

3 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 05 Dec 2011, 04:17 PM
Hi Aurore,

 You can edit the default Style of RadColorSelector and the Style of the RadColorPaletteViewItem. The you can attach for the MouseLeftButtonDownEvent of the Rectangle that holds the Color in the PalleteViewItem.
This event will fire every time when you click on a color from the palette, even if it is the currently selected one.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aurore
Top achievements
Rank 1
answered on 05 Dec 2011, 05:03 PM
Can you give me an example ?

Thanks
Aurore
0
Petar Mladenov
Telerik team
answered on 08 Dec 2011, 03:39 PM
Hi Aurore,

 I created a project for you. Please note that both HeaderPalette and StandartPalette in the template of the ColorSelector use one and the same ItemContainerStyle. Please let us know if this satisfies you.

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ColorPicker
Asked by
Aurore
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Aurore
Top achievements
Rank 1
Share this question
or