【问题标题】:Button Style Creators Update UWP按钮样式创作者更新 UWP
【发布时间】:2017-10-20 06:12:34
【问题描述】:

我正在尝试使按钮的效果与 Windows 10 Creators Update 应用程序中的效果相同。

按钮图片示例

.

我已经使用 SDK 插入了亚克力效果:

MainPage.xaml 代码:

<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="BaseGrid" Background="{ThemeResource SystemControlAcrylicElementBrush}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="1" HorizontalAlignment="Stretch" Background="White">
        </Grid>
    </Grid>
</Grid>

MainPage.xaml.cs 代码:

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
        Windows.UI.Xaml.Media.AcrylicBrush myBrush = new Windows.UI.Xaml.Media.AcrylicBrush();
        myBrush.BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop;
        myBrush.TintColor = Color.FromArgb(255, 202, 24, 37);
        myBrush.FallbackColor = Color.FromArgb(255, 202, 24, 37);
        myBrush.TintOpacity = 0.6;
        BaseGrid.Background = myBrush;
    }
}

但是怎么可能有鼠标在通过时的“光”效果,点击时的波浪效果呢?

应该是独特的风格吗?

提前致谢!

【问题讨论】:

    标签: c# xaml uwp


    【解决方案1】:

    非常熟悉您在地图应用中发布的示例。您正在寻找的效果称为reveal。您可以使用多种样式来启用各种控件的效果(例如,ButtonRevealStyle 用于按钮)。对于AutoSuggestBox,您希望对建议列表中的项目启用效果。

    如果您有一个 ListView 并且在其 ListViewItem 元素中嵌套了按钮或可调用内容,则应该为嵌套项目启用 Reveal。

    为此,您需要将AutoSuggestBox 上的ItemContainerStyle 属性设置为基于ListViewItemRevealStyle 的自定义ListViewItem 样式。如果您对这种风格发生的事情感兴趣,可以在 generic.xaml 中查看。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多