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

Restrict ColorMode

3 Answers 44 Views
ColorEditor
This is a migrated thread and some comments may be shown as answers.
Flemming Rosenbrandt
Top achievements
Rank 1
Flemming Rosenbrandt asked on 20 Mar 2014, 09:28 AM
How do I restrict the ColorMode to RGB only?

/Flemming Rosenbrandt

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 25 Mar 2014, 07:12 AM
Hi Flemming,

There is no "out of the box" way to achieve this requirement. You can edit the default Style of the RadColorEditor. In it , there is a RadComboBox bound to collection of ColorModeWrapper classes:
xmlns:colorMode="clr-namespace:Telerik.Windows.Controls.ColorEditor.Mode"

<colorMode:ColorModeCollection x:Key="ColorModeCollection" />
 
<telerikInput:RadComboBox IsEditable="True" telerik:StyleManager.Theme="{StaticResource Theme}" IsReadOnly="True"
                                                          ItemsSource="{Binding Source={StaticResource ColorModeCollection}}"
                                                          SelectedIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorMode, Mode=TwoWay, Converter={StaticResource EnumConverter}}">
And the ColorModeCollection is defined as follows:
/// <summary>
/// Represents a collection of enum wrappers.
/// </summary>
public class ColorModeCollection : List<ColorModeWrapper>
{
    /// <summary>
    /// Initializes a new instance of the <see cref="ColorModeCollection"/> class.
    /// </summary>
    public ColorModeCollection()
    {
        this.Add(new ColorModeWrapper() { EnumValue = (int)ColorMode.CMYK });
        this.Add(new ColorModeWrapper() { EnumValue = (int)ColorMode.HLS });
        this.Add(new ColorModeWrapper() { EnumValue = (int)ColorMode.HSV });
        this.Add(new ColorModeWrapper() { EnumValue = (int)ColorMode.RGB });
    }
}
What can you do is to create a new ColorModeCollection class with RGB ColorModeWrapper only and bind it to the mentioned ComboBox in XAML.

Regards,
Petar Mladenov
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Flemming Rosenbrandt
Top achievements
Rank 1
answered on 25 Mar 2014, 11:42 AM
Thank you for the answer.

If I am to edit the style of the RadColorEditor anyway – I could just hide the ComboBox?

I would have expected this feature to be a natural part of the ActiveSections property?

/Flemming Rosenbrandt

0
Petar Mladenov
Telerik team
answered on 26 Mar 2014, 08:29 AM
Hello Flemming,

Yes you can edit the Style of the RadColorEditor and set the Visibility of this RadComboBox. 
Actually you can submit a feature requests for our controls in our new Feedback Portal. In this case you can describe that you need a property (for example ColorModeComboVisbility) or a way to extend the ActiveSections.

Regards,
Petar Mladenov
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
ColorEditor
Asked by
Flemming Rosenbrandt
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Flemming Rosenbrandt
Top achievements
Rank 1
Share this question
or