CustomListView.xaml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <UserControl x:Class="UICommon.Controls.CustomListView"
  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:local="clr-namespace:UICommon.Controls"
  7. mc:Ignorable="d"
  8. x:Name="This"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <UserControl.Resources>
  11. <Style x:Key="UpButton" TargetType="Button">
  12. <Setter Property="Foreground" Value="White"/>
  13. <Setter Property="BorderThickness" Value="0"/>
  14. <Setter Property="Background" Value="{StaticResource ThemeColor}"/>
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="Button">
  18. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="0,4,0,0">
  19. <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  20. </Border>
  21. <ControlTemplate.Triggers>
  22. <Trigger Property="IsEnabled" Value="False">
  23. <Setter TargetName="border" Property="Background" Value="{StaticResource DisableColor}"/>
  24. </Trigger>
  25. <Trigger Property="IsPressed" Value="True">
  26. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  27. </Trigger>
  28. <Trigger Property="AreAnyTouchesOver" Value="True">
  29. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  30. </Trigger>
  31. </ControlTemplate.Triggers>
  32. </ControlTemplate>
  33. </Setter.Value>
  34. </Setter>
  35. </Style>
  36. <Style x:Key="MiddleButton" TargetType="Button">
  37. <Setter Property="Foreground" Value="White"/>
  38. <Setter Property="BorderThickness" Value="0"/>
  39. <Setter Property="Background" Value="{StaticResource ThemeColor}"/>
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate TargetType="Button">
  43. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
  44. <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  45. </Border>
  46. <ControlTemplate.Triggers>
  47. <Trigger Property="IsEnabled" Value="False">
  48. <Setter TargetName="border" Property="Background" Value="{StaticResource DisableColor}"/>
  49. </Trigger>
  50. <Trigger Property="IsPressed" Value="True">
  51. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  52. </Trigger>
  53. <Trigger Property="AreAnyTouchesOver" Value="True">
  54. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  55. </Trigger>
  56. </ControlTemplate.Triggers>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. </Style>
  61. <Style x:Key="DownButton" TargetType="Button">
  62. <Setter Property="Foreground" Value="White"/>
  63. <Setter Property="BorderThickness" Value="0"/>
  64. <Setter Property="Background" Value="{StaticResource ThemeColor}"/>
  65. <Setter Property="Template">
  66. <Setter.Value>
  67. <ControlTemplate TargetType="Button">
  68. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="0,0,4,0">
  69. <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  70. </Border>
  71. <ControlTemplate.Triggers>
  72. <Trigger Property="IsEnabled" Value="False">
  73. <Setter TargetName="border" Property="Background" Value="{StaticResource DisableColor}"/>
  74. </Trigger>
  75. <Trigger Property="IsPressed" Value="True">
  76. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  77. </Trigger>
  78. <Trigger Property="AreAnyTouchesOver" Value="True">
  79. <Setter TargetName="border" Property="Background" Value="{StaticResource LightThemeColor}"/>
  80. </Trigger>
  81. </ControlTemplate.Triggers>
  82. </ControlTemplate>
  83. </Setter.Value>
  84. </Setter>
  85. </Style>
  86. </UserControl.Resources>
  87. <Border Background="#f5f7fa" CornerRadius="4">
  88. <Grid>
  89. <Grid.ColumnDefinitions>
  90. <ColumnDefinition/>
  91. <ColumnDefinition Width="1"/>
  92. <ColumnDefinition Width="32"/>
  93. </Grid.ColumnDefinitions>
  94. <Grid.RowDefinitions>
  95. <RowDefinition Height="21"/>
  96. <RowDefinition/>
  97. </Grid.RowDefinitions>
  98. <Border Background="{StaticResource ThemeColor}" CornerRadius="4,0,0,0">
  99. </Border>
  100. <Grid Grid.RowSpan="3" Grid.Column="2">
  101. <Grid.RowDefinitions>
  102. <RowDefinition/>
  103. <RowDefinition Height="1"/>
  104. <RowDefinition/>
  105. <RowDefinition Height="1"/>
  106. <RowDefinition/>
  107. <RowDefinition Height="1"/>
  108. <RowDefinition/>
  109. </Grid.RowDefinitions>
  110. <Button Grid.Row="0" Style="{StaticResource UpButton}">
  111. <StackPanel>
  112. <Image Source="{StaticResource ArrowUP}" Width="8"/>
  113. <Image Source="{StaticResource ArrowUP}" Width="8"/>
  114. </StackPanel>
  115. </Button>
  116. <Button Grid.Row="2" Style="{StaticResource MiddleButton}">
  117. <Image Source="{StaticResource ArrowUP}" Width="8"/>
  118. </Button>
  119. <Button Grid.Row="4" Style="{StaticResource MiddleButton}">
  120. <Image Source="{StaticResource ArrowDown}" Width="8"/>
  121. </Button>
  122. <Button Grid.Row="6" Style="{StaticResource DownButton}">
  123. <StackPanel>
  124. <Image Source="{StaticResource ArrowDown}" Width="8"/>
  125. <Image Source="{StaticResource ArrowDown}" Width="8"/>
  126. </StackPanel>
  127. </Button>
  128. </Grid>
  129. <ItemsControl Grid.Row="1" ItemsSource="{Binding ElementName=This, Path=Source}">
  130. <ItemsControl.ItemTemplate>
  131. <DataTemplate>
  132. <Border Height="42" BorderBrush="#DBE2ED" BorderThickness="1">
  133. <TextBlock>AAA</TextBlock>
  134. </Border>
  135. </DataTemplate>
  136. </ItemsControl.ItemTemplate>
  137. </ItemsControl>
  138. </Grid>
  139. </Border>
  140. </UserControl>