代码之家  ›  专栏  ›  技术社区  ›  Allen Rufolo

使UWP颜色选择器变小或变大

  •  0
  • Allen Rufolo  · 技术社区  · 7 年前

    UWP Color Picker Documentation

    在UWP中,似乎没有办法调整颜色选择器的大小。如下面的示例所示设置宽度似乎没有任何作用。设置高度只会切断低于指定高度的颜色选择器的其余部分。

    <ColorPicker x:Name="myColorPicker"
             ColorSpectrumShape=”Ring”
             IsColorPreviewVisible="False"
             IsColorChannelTextInputVisible="False"
             IsHexInputVisible="False"
             Width="50"
             Height="50"
             />
    
    0 回复  |  直到 7 年前
        1
  •  2
  •   Allen Rufolo    7 年前

    明白了。我所要做的就是将颜色选择器包装在ViewBox元素中。

    <Viewbox Margin="5" MaxWidth="150" Stretch="Fill">
        <ColorPicker x:Name="myColorPicker"
         ColorSpectrumShape=”Ring”
         IsColorPreviewVisible="False"
         IsColorChannelTextInputVisible="False"
         IsHexInputVisible="False"
         />
    </Viewbox>
    
    推荐文章