【问题标题】:WinRT XAML Toolkit NumericUpDown TemplateWinRT XAML 工具包 NumericUpDown 模板
【发布时间】:2016-07-24 10:15:15
【问题描述】:

我在 Windows 通用应用程序 C# 中使用 WinRT XAML 工具包。 我想改变加号(+)和减号(-)按钮之间的距离并增加两个按钮的大小。

有一些模板可用于 WPF,但不适用于通用应用程序。

Here is image 请告诉我如何实现它?

【问题讨论】:

    标签: xaml winrt-xaml winrt-xaml-toolkit


    【解决方案1】:

    模板在工具包here中。

    您可以通过更改这些按钮样式来添加Margin

    <!-- DecrementButtonStyle -->
    <Style
        x:Key="DecrementButtonStyle"
        BasedOn="{StaticResource NumericUpDownButtonStyle}"
        TargetType="RepeatButton">
        <Setter
            Property="Content"
            Value="&#x2796;" />
        <Setter
            Property="Margin"
            Value="5" />
    </Style>
    
    <!-- IncrementButtonStyle -->
    <Style
        x:Key="IncrementButtonStyle"
        BasedOn="{StaticResource NumericUpDownButtonStyle}"
        TargetType="RepeatButton">
        <Setter
            Property="Content"
            Value="&#x2795;" />
        <Setter
            Property="Margin"
            Value="5" />
    </Style>
    

    【讨论】:

    • 它在 Windows 通用应用程序中的异常代码。
    • 那么,异常和堆栈是什么?顺便说一句,我刚刚意识到模板中的按钮已经指定了边距,所以您可能需要在模板的其他地方设置它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多