【问题标题】:How to design a non-flat UI in XAML如何在 XAML 中设计非平面 UI
【发布时间】:2015-10-12 18:13:01
【问题描述】:

有没有可能在 C# 中创建非平面设计? XAML好像没有实现buttonsdropdowns等无边框控件表单的内阴影功能?

【问题讨论】:

    标签: c# xaml winrt-xaml


    【解决方案1】:

    要创建非平面控件,请使用线性和径向渐变画笔填充背景。

    如果您不知道如何在 XAML 中创建画笔,您可以使用 Blend 来设计画笔。

    对于无边框窗口,将窗口的 WindowStyle 设置为 None。

    这是一个例子:

    <Button HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Content="Click Me"
            Foreground="White">
        <Button.Template>
            <ControlTemplate TargetType="Button">
                <Grid>
                    <Rectangle>
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Offset="0" Color="#FF4D4C4C" />
                                <GradientStop Offset="1" Color="#FF1D1D1D" />
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <ContentPresenter Margin="10"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center" />
                </Grid>
            </ControlTemplate>
        </Button.Template>
    </Button>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-15
      • 2017-11-27
      • 2014-12-02
      • 1970-01-01
      • 2018-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多