Advertisement
Guest User

SnapList.xaml

a guest
Apr 24th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.27 KB | None | 0 0
  1. <UserControl x:Class="ATypeSurfaceControls.SnapList"
  2.             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5.             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6.             xmlns:s="http://schemas.microsoft.com/surface/2008"
  7.             xmlns:local="clr-namespace:ATypeSurfaceControls"
  8.             mc:Ignorable="d"
  9.             d:DesignHeight="300" d:DesignWidth="300">
  10.     <UserControl.Resources>
  11.         <local:EndToMarginConverter x:Key="ETMc"/>
  12.         <local:VerticalHalfMarginConverter x:Key="Vc"/>
  13.     </UserControl.Resources>
  14.    
  15.     <Grid x:Name="LayoutRoot">
  16.         <s:SurfaceListBox x:Name="List" VerticalAlignment="Center" HorizontalAlignment="Stretch"
  17.                            ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SnapList}}}"
  18.                            ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  19.             <s:SurfaceListBox.Style>
  20.                 <Style TargetType="{x:Type s:SurfaceListBox}">
  21.                     <Setter Property="Template">
  22.                         <Setter.Value>
  23.                             <ControlTemplate TargetType="{x:Type s:SurfaceListBox}">
  24.                                 <s:SurfaceScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" >
  25.                                     <VirtualizingStackPanel Orientation="Vertical" IsItemsHost="True"
  26.                                                            Margin="{Binding ActualHeight, ElementName=LayoutRoot, Converter={StaticResource Vc}}"></VirtualizingStackPanel>
  27.                                 </s:SurfaceScrollViewer>
  28.                             </ControlTemplate>
  29.                         </Setter.Value>
  30.                     </Setter>
  31.                 </Style>
  32.             </s:SurfaceListBox.Style>
  33.             <s:SurfaceListBox.ItemContainerStyle>
  34.                 <Style TargetType="{x:Type s:SurfaceListBoxItem}">
  35.                     <Setter Property="RenderTransformOrigin">
  36.                         <Setter.Value>
  37.                             <Point X="0.5" Y="0.5"/>
  38.                         </Setter.Value>
  39.                     </Setter>
  40.                     <Setter Property="Height" Value="200"/>
  41.                     <Setter Property="Padding" Value="0"/>
  42.                     <Setter Property="VerticalContentAlignment" Value="Center"/>
  43.                     <Setter Property="Margin" Value="4"/>
  44.                     <Setter Property="ContentTemplate" Value="{Binding ItemContentTemplate, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SnapList}}}">
  45.                     </Setter>
  46.                     <Setter Property="Template" Value="{Binding ItemTemplate, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SnapList}}}">
  47.                     </Setter>
  48.                     <EventSetter Event="Selected" Handler="ListItem_Selected"/>
  49.                 </Style>
  50.             </s:SurfaceListBox.ItemContainerStyle>
  51.         </s:SurfaceListBox>
  52.         <local:ScrollViewerOffsetMediator x:Name="Mediator" />
  53.     </Grid>
  54. </UserControl>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement