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
/Flemming Rosenbrandt
3 Answers, 1 is accepted
0
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:
And the ColorModeCollection is defined as follows:
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
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}}"
>
/// <
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 });
}
}
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
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
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
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.