c# - 使 UWP 颜色选择器变小或变大
问题描述
在 UWP 中似乎没有开箱即用的方法来调整拾色器的大小。如下例所示设置宽度似乎没有任何作用。设置高度只会切断低于指定高度的颜色选择器的其余部分。
我错过了什么吗?其他人是否已经提出了解决方法?这似乎应该是开箱即用的东西。
<ColorPicker x:Name="myColorPicker"
ColorSpectrumShape=”Ring”
IsColorPreviewVisible="False"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
Width="50"
Height="50"
/>
解决方案
弄清楚了。我所要做的就是将 ColorPicker 包装在 ViewBox 元素中。
<Viewbox Margin="5" MaxWidth="150" Stretch="Fill">
<ColorPicker x:Name="myColorPicker"
ColorSpectrumShape=”Ring”
IsColorPreviewVisible="False"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
/>
</Viewbox>