2017-10-19 51 views
0

我试图让按钮的效果在Windows 10创作者更新的应用程序。按钮样式创作者更新UWP

例按钮图像

Example Button

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中代码:

我已经使用SDK已经插入丙烯酸效果

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; 
    } 
} 

但怎样才能让鼠标的“光”效应通过,波浪效应在哪里?点击?

它应该是一个独特的风格?

在此先感谢!

回答

2

非常熟悉你从地图应用程序发布的例子。您正在寻找的效果被称为reveal。有多种款式,您可以使用,使各种控制效果(例如,ButtonRevealStyle的按钮)。对于AutoSuggestBox,你正在寻找能够在建议名单中的项目的效果。

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

要做到这一点,你需要在AutoSuggestBoxItemContainerStyle属性设置为是基于ListViewItemRevealStyle定制ListViewItem风格。如果你有兴趣在什么是在风格回事,你可以检查出来的generic.xaml。