【问题标题】:Modify the size of ColorPicker palette修改 ColorPicker 调色板的大小
【发布时间】:2016-05-06 13:19:53
【问题描述】:

由于某些 GUI 尺寸限制,我想修改 XCeed ColorPicker 的调色板的尺寸。按钮的宽度小于下拉弹出框;我只想更改弹出窗口的宽度(或高度)以强加可用标准颜色的布局。默认情况下,我们有 10 列颜色,我希望有 6 或 8 列颜色。有什么办法吗?

【问题讨论】:

    标签: c# color-picker xceed wpf-extended-toolkit


    【解决方案1】:

    在 ColorPicker 的默认模板中,您会注意到一个名为“PART_AvailableColors”的列表框。该列表框使用一种名为“ColorListStyle”的样式。在该样式中,我们将 ItemsPanel 属性设置为宽度为 200 的 WrapPanel。

    <Style x:Key="ColorListStyle" TargetType="ListBox">
        <!-- ... --->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Width="200" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <!-- ... --->
    </Style>
    

    不幸的是,目前没有内置方法可以轻松更改 ColorPicker 的布局,所以目前我可以提供的唯一选择是重做代码中的模板/样式以在 WrapPanel 上设置不同的宽度。

    默认模板和样式可以在工具包附带的源代码中找到。

    编辑:属性 MaxDropDownWidth 已添加到 ColorPicker 以自定义弹出窗口的宽度(3.1 版中的新功能)。

    【讨论】:

      猜你喜欢
      • 2015-05-31
      • 2021-03-30
      • 1970-01-01
      • 2018-09-29
      • 1970-01-01
      • 1970-01-01
      • 2015-12-29
      • 2023-03-20
      • 2015-11-24
      相关资源
      最近更新 更多