Skip to content

Instantly share code, notes, and snippets.

@SuperJMN
Last active October 29, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SuperJMN/a8520f9db2cf7c4b2a4e to your computer and use it in GitHub Desktop.
Save SuperJMN/a8520f9db2cf7c4b2a4e to your computer and use it in GitHub Desktop.
Snippets
<Page
x:Class="App10.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App10"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="using:System"
xmlns:collections="using:System.Collections"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="MyStyle" TargetType="ListView">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListView">
<Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="Full">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1000" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="My.ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapGrid MaximumRowsOrColumns="3" ItemWidth="200" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Snapped">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="My.ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapGrid MaximumRowsOrColumns="5" ItemWidth="200" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ItemsControl x:Name="My" ItemsSource="{TemplateBinding ItemsSource}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<local:StringCollection x:Key="Items">
<x:String>HOLA</x:String>
<x:String>CÓMO</x:String>
<x:String>ESTÁS</x:String>
<x:String>YO</x:String>
<x:String>ESTOY</x:String>
<x:String>BIEN</x:String>
<x:String>ME GUSTAN</x:String>
<x:String>MUCHO</x:String>
<x:String>MIS PIRULAS</x:String>
<x:String>TANTO</x:String>
<x:String>QUE ME</x:String>
<x:String>DOY MIEDO</x:String>
<x:String>HOLA</x:String>
<x:String>CÓMO</x:String>
<x:String>ESTÁS</x:String>
<x:String>YO</x:String>
<x:String>ESTOY</x:String>
<x:String>BIEN</x:String>
<x:String>ME GUSTAN</x:String>
<x:String>MUCHO</x:String>
<x:String>MIS PIRULAS</x:String>
<x:String>TANTO</x:String>
<x:String>QUE ME</x:String>
<x:String>DOY MIEDO</x:String>
</local:StringCollection>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ListView ItemsSource="{StaticResource Items}" Style="{StaticResource MyStyle}" />
</Grid>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment