似乎没有一种开箱即用的方法来调整 UWP 中拾色器的大小。在下面的示例中设置宽度似乎没有做任何事情。设置高度只会切断指定高度以下的颜色选择器的其余部分。
我错过了什么吗?其他人已经提出了解决方法吗?这似乎应该是开箱即用的东西。
<ColorPicker x:Name="myColorPicker"
ColorSpectrumShape=”Ring”
IsColorPreviewVisible="False"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
Width="50"
Height="50"
/>
Run Code Online (Sandbox Code Playgroud)
弄清楚了。我所要做的就是将 ColorPicker 包装在 ViewBox 元素中。
<Viewbox Margin="5" MaxWidth="150" Stretch="Fill">
<ColorPicker x:Name="myColorPicker"
ColorSpectrumShape=”Ring”
IsColorPreviewVisible="False"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
/>
</Viewbox>
Run Code Online (Sandbox Code Playgroud)