Created
December 2, 2017 22:23
-
-
Save LanceMcCarthy/983057662010c7fd3400ee7ba9719916 to your computer and use it in GitHub Desktop.
FlyoutPresenter with Acrylic Brush Background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ItemViewModel | |
{ | |
public string Title { get; set; } | |
public string ThumbnailUrl { get; set; } | |
public List<string> Details { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page | |
x:Class="AaronTest.MainPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:AaronTest" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:viewModels="using:AaronTest.ViewModels" | |
mc:Ignorable="d"> | |
<Page.DataContext> | |
<viewModels:MainViewModel /> | |
</Page.DataContext> | |
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |
<GridView ItemsSource="{Binding Items}" SelectionMode="None" Margin="10"> | |
<GridView.ItemContainerStyle> | |
<Style TargetType="GridViewItem"> | |
<Setter Property="Padding" Value="0" /> | |
<Setter Property="Margin" Value="5" /> | |
</Style> | |
</GridView.ItemContainerStyle> | |
<GridView.ItemTemplate> | |
<DataTemplate x:DataType="viewModels:ItemViewModel"> | |
<Grid> | |
<Button Content="{Binding Title}" Width="100" Height="75" Background="DarkRed" Foreground="White"> | |
<Button.Flyout> | |
<Flyout> | |
<Flyout.FlyoutPresenterStyle> | |
<Style TargetType="FlyoutPresenter"> | |
<Setter Property="Padding" Value="0"/> | |
<Setter Property="Background" Value="{ThemeResource SystemControlBaseHighAcrylicElementMediumBrush}"/> | |
</Style> | |
</Flyout.FlyoutPresenterStyle> | |
<Grid Height="200" Width="333" > | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="1*"/> | |
<ColumnDefinition Width="2*" /> | |
</Grid.ColumnDefinitions> | |
<Grid x:Name="LeftPanel" > | |
<ListView ItemsSource="{Binding Details}"/> | |
</Grid> | |
<Grid x:Name="RightPanel" Grid.Column="1"> | |
<Image Source="{Binding ThumbnailUrl}" Stretch="UniformToFill"/> | |
<Border Background="#7FFFFFFF" VerticalAlignment="Top"> | |
<TextBlock Text="{Binding Title}" HorizontalAlignment="Center" VerticalAlignment="Top"/> | |
</Border> | |
</Grid> | |
</Grid> | |
</Flyout> | |
</Button.Flyout> | |
</Button> | |
</Grid> | |
</DataTemplate> | |
</GridView.ItemTemplate> | |
</GridView> | |
</Grid> | |
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainViewModel | |
{ | |
public MainViewModel() | |
{ | |
for (int i = 0; i < 30; i++) | |
{ | |
Items.Add(new ItemViewModel | |
{ | |
Title = $"Item {i}", | |
ThumbnailUrl = "/Images/Thumb.png", | |
Details = new List<string> { $"Detail {i}-1", $"Detail {i}-2", $"Detail {i}-3" } | |
}); | |
} | |
} | |
public ObservableCollection<ItemViewModel> Items { get; set; } = new ObservableCollection<ItemViewModel>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment