Replies: 1 comment
-
Hi @dnlnm You can change the default content and change the converter to show the color string without alpha channel. Below is example implementation of a converter: public static readonly IValueConverter ToColorStringConverter =
new FuncValueConverter<ColorPicker, string, string>((
picker, param) =>
{
if (picker is null) return "";
var toUpper = param is "ToUpper";
var color = new SolidColorBrush(picker.HsvColor.ToRgb()).ToString();
if (picker is { IsAlphaEnabled: true, IsAlphaVisible: true }) return toUpper ? color.ToUpper() : color;
var rgb = picker.HsvColor.ToRgb();
color = $"#{rgb.R:X2}{rgb.G:X2}{rgb.B:X2}";
return toUpper ? color.ToUpper() : color;
}); The default content template is look like this: <StackPanel Orientation="Horizontal" Spacing="8">
<Border
Width="24"
Height="24"
Background="{Binding $parent[ColorPicker].HsvColor, Converter={x:Static shadui:BasicConverters.ToBrushConverter}}"
CornerRadius="{DynamicResource SmCornerRadius}" />
<TextBlock
VerticalAlignment="Center"
Classes="Small"
ext="{Binding $parent[ColorPicker], Converter={x:Static shadui:BasicConverters.ToColorStringConverter}, ConverterParameter='ToUpper'}" />
</StackPanel> See 562b841 which allow what you want to achive. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to hide the hexcode for the transparency on the color picker?
I have set
IsAlphaEnabled="False"
andIsAlphaVisible="False"
but it still showing.Beta Was this translation helpful? Give feedback.
All reactions