2017-10-19 61 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。