clear selectedcolor

4 posts, 1 answers
  1. Aurore
    Aurore avatar
    58 posts
    Member since:
    Nov 2007

    Posted 30 Nov 2011 Link to this post

    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
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Dec 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Aurore
    Aurore avatar
    58 posts
    Member since:
    Nov 2007

    Posted 05 Dec 2011 Link to this post

    Can you give me an example ?

    Thanks
    Aurore
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 08 Dec 2011 Link to this post

    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 >>

Back to Top