Workspace.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <Page x:Class="WechatBakTool.Pages.Workspace"
  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:WechatBakTool.Pages"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="720"
  9. Title="Workspace" Background="White">
  10. <Page.Resources>
  11. <local:MsgTemplateSelector x:Key="MsgTemplateSelector"/>
  12. <Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
  13. <Setter Property="Template">
  14. <Setter.Value>
  15. <ControlTemplate>
  16. <!--下拉按钮内部背景色-->
  17. <Border x:Name="Back" Background="{Binding Background, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="1,0,0,0" CornerRadius="0,3,3,0">
  18. <!--下拉按钮内边框-->
  19. <Path Name="PathFill" Fill="{Binding Foreground, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="10" Height="6" StrokeThickness="0" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
  20. <Path.RenderTransform>
  21. <TransformGroup>
  22. <ScaleTransform/>
  23. <SkewTransform/>
  24. <RotateTransform Angle="180"/>
  25. <TranslateTransform/>
  26. </TransformGroup>
  27. </Path.RenderTransform>
  28. </Path>
  29. </Border>
  30. <ControlTemplate.Triggers>
  31. <Trigger Property="IsMouseOver" Value="True">
  32. <Setter TargetName="PathFill" Property="Fill" Value="White"></Setter>
  33. </Trigger>
  34. </ControlTemplate.Triggers>
  35. </ControlTemplate>
  36. </Setter.Value>
  37. </Setter>
  38. <Style.Triggers>
  39. <DataTrigger Binding="{Binding Path=IsEnabled, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Value="False">
  40. <Setter Property="Background" Value="#efefef" />
  41. <Setter Property="Opacity" Value="1" />
  42. <Setter Property="Foreground" Value="#000000" />
  43. </DataTrigger>
  44. <DataTrigger Binding="{Binding Path=IsEnabled, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
  45. <Setter Property="Background" Value="#2775b6" />
  46. <Setter Property="Foreground" Value="#ffffff" />
  47. </DataTrigger>
  48. </Style.Triggers>
  49. </Style>
  50. <Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
  51. </Style>
  52. <!--Combox-->
  53. <Style TargetType="ComboBox" x:Key="ComboBoxStyle">
  54. <Setter Property="ItemContainerStyle">
  55. <Setter.Value>
  56. <!--ComBoxItem-->
  57. <Style TargetType="ComboBoxItem">
  58. <Setter Property="MinHeight" Value="22"></Setter>
  59. <Setter Property="MinWidth" Value="60"></Setter>
  60. <Setter Property="Foreground" Value="White"/>
  61. <Setter Property="Template">
  62. <Setter.Value>
  63. <ControlTemplate TargetType="ComboBoxItem">
  64. <Border Name="Back" Background="Transparent" BorderThickness="0">
  65. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" ></ContentPresenter>
  66. </Border>
  67. <ControlTemplate.Triggers>
  68. <Trigger Property="IsMouseOver" Value="True">
  69. <Setter TargetName="Back" Property="Background" Value="#BB2775b6"></Setter>
  70. </Trigger>
  71. <!--下拉框背景色-->
  72. <Trigger Property="IsHighlighted" Value="True">
  73. <Setter TargetName="Back" Property="Background" Value="#2775b6"></Setter>
  74. </Trigger>
  75. </ControlTemplate.Triggers>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. </Style>
  80. </Setter.Value>
  81. </Setter>
  82. <Setter Property="Template">
  83. <Setter.Value>
  84. <ControlTemplate TargetType="ComboBox">
  85. <Grid>
  86. <Grid.ColumnDefinitions>
  87. <ColumnDefinition Width="0.7*"/>
  88. <ColumnDefinition Width="0.3*" MaxWidth="30"/>
  89. </Grid.ColumnDefinitions>
  90. <!--文字区域背景和边线样式-->
  91. <Border Grid.Column="0" BorderThickness="1" BorderBrush="{Binding Background, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="3,0,0,3">
  92. <Button Name="export" Click="Export_Click" Background="{Binding Background, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Foreground="White" Grid.Column="0" BorderThickness="0" Content="{TemplateBinding Text}" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="8,0,0,0">
  93. </Button>
  94. </Border>
  95. <!--右侧下拉button设置-->
  96. <Border Grid.Column="1" BorderThickness="0">
  97. <ToggleButton BorderThickness="3" Style="{StaticResource ComboxStyleBtn}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
  98. </Border>
  99. <!--弹出popup整体设置-->
  100. <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="False" PopupAnimation="Slide" >
  101. <!--弹出popup边框-->
  102. <Border CornerRadius="3" BorderThickness="0" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
  103. <!--下拉幕布边界背景设置 MaxHeight="{TemplateBinding MaxDropDownHeight}"-->
  104. <ScrollViewer Margin="0,0,0,0" Background="Gray" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" BorderBrush="Gray" BorderThickness="0" >
  105. <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
  106. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="#BB2775b6" />
  107. </ScrollViewer>
  108. </Border>
  109. </Popup>
  110. </Grid>
  111. </ControlTemplate>
  112. </Setter.Value>
  113. </Setter>
  114. </Style>
  115. <Style x:Key="RepeatButtonTransparent" TargetType="{x:Type RepeatButton}">
  116. <Setter Property="OverridesDefaultStyle" Value="true"/>
  117. <Setter Property="Background" Value="#2775b6"/>
  118. <Setter Property="Focusable" Value="false"/>
  119. <Setter Property="IsTabStop" Value="false"/>
  120. <Setter Property="Template">
  121. <Setter.Value>
  122. <ControlTemplate TargetType="{x:Type RepeatButton}">
  123. <Border Background="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" CornerRadius="4"/>
  124. </ControlTemplate>
  125. </Setter.Value>
  126. </Setter>
  127. </Style>
  128. <!-- 这里是listview滚动条的滑动块部分样式-->
  129. <Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type Thumb}">
  130. <Setter Property="OverridesDefaultStyle" Value="true"/>
  131. <Setter Property="IsTabStop" Value="false"/>
  132. <Setter Property="Template">
  133. <Setter.Value>
  134. <ControlTemplate TargetType="{x:Type Thumb}">
  135. <Border x:Name="rectangle" Background="#BB2775b6" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}" CornerRadius="4"/>
  136. <ControlTemplate.Triggers>
  137. <Trigger Property="IsMouseOver" Value="true">
  138. <Setter Property="Background" TargetName="rectangle" Value="#772775b6"/>
  139. </Trigger>
  140. <Trigger Property="IsDragging" Value="true">
  141. <Setter Property="Background" TargetName="rectangle" Value="#772775b6"/>
  142. </Trigger>
  143. </ControlTemplate.Triggers>
  144. </ControlTemplate>
  145. </Setter.Value>
  146. </Setter>
  147. </Style>
  148. <DataTemplate x:Key="ListViewItemContentTemplate">
  149. <Grid Margin="0">
  150. <Image Width="40" Height="40" Margin="10" VerticalAlignment="Top" HorizontalAlignment="Left" Source="{Binding Avatar}" />
  151. <Label Margin="60,8,0,0" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left" Content="{Binding NickName}" Width="130"/>
  152. <Label Margin="60,25,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="140" Content="{Binding LastMsg}"/>
  153. </Grid>
  154. </DataTemplate>
  155. <DataTemplate x:Key="MsgText">
  156. <Grid Margin="0">
  157. <Label Margin="60,8,0,0" FontWeight="Bold" VerticalAlignment="Top" Content="{Binding NickName}"/>
  158. <Label Margin="60,25,0,8" VerticalAlignment="Top" HorizontalAlignment="Left" Width="380">
  159. <TextBlock Text="{Binding DisplayContent}" TextWrapping="Wrap" />
  160. </Label>
  161. </Grid>
  162. </DataTemplate>
  163. <DataTemplate x:Key="MsgImage">
  164. <Grid Margin="0">
  165. <Label Margin="60,8,0,0" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left" Content="{Binding NickName}" Width="130"/>
  166. <Label Margin="60,25,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="140" Content="1111"/>
  167. </Grid>
  168. </DataTemplate>
  169. <DataTemplate x:Key="MsgAudio">
  170. <Grid Margin="0">
  171. <Image Width="40" Height="40" Margin="10" VerticalAlignment="Top" HorizontalAlignment="Left" Source="{Binding Avatar}" />
  172. <Label Margin="60,8,0,0" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left" Content="{Binding NickName}" Width="130"/>
  173. <Label Margin="60,25,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="140" Content="{Binding LastMsg}"/>
  174. </Grid>
  175. </DataTemplate>
  176. </Page.Resources>
  177. <Grid>
  178. <TextBox Name="txt_find_user" Padding="10,0" Height="30" VerticalAlignment="Top" VerticalContentAlignment="Center" FontSize="14" HorizontalAlignment="Left" Width="230" BorderThickness="0,0,10,1" BorderBrush="#2775b6" TextChanged="txt_find_user_TextChanged" GotFocus="txt_find_user_GotFocus" Text="{Binding SearchString, Mode=TwoWay}" />
  179. <ListView Margin="0,30,0,0" Background="Transparent" HorizontalAlignment="Left" Width="230" Name="list_users" ItemTemplate="{DynamicResource ListViewItemContentTemplate}" BorderThickness="0,0,1,0" BorderBrush="#2775b6" SelectionChanged="list_users_SelectionChanged" ItemsSource="{Binding Contacts}">
  180. <ListView.Resources>
  181. <Style TargetType="{x:Type ScrollBar}">
  182. <Setter Property="Background" Value="Transparent"/>
  183. <Setter Property="BorderBrush" Value="Transparent"/>
  184. <Setter Property="BorderThickness" Value="0" />
  185. <Setter Property="Template">
  186. <Setter.Value>
  187. <ControlTemplate TargetType="{x:Type ScrollBar}">
  188. <Grid x:Name="Bg" SnapsToDevicePixels="true" Width="8" HorizontalAlignment="Right">
  189. <Grid.RowDefinitions>
  190. <RowDefinition Height="0"/>
  191. <RowDefinition Height="1*"/>
  192. <RowDefinition Height="0"/>
  193. </Grid.RowDefinitions>
  194. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Row="1" CornerRadius="5"/>
  195. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
  196. <Track.DecreaseRepeatButton>
  197. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource RepeatButtonTransparent}" HorizontalAlignment="Right" Width="8"/>
  198. </Track.DecreaseRepeatButton>
  199. <Track.IncreaseRepeatButton>
  200. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource RepeatButtonTransparent}" HorizontalAlignment="Right" Width="8"/>
  201. </Track.IncreaseRepeatButton>
  202. <Track.Thumb>
  203. <Thumb Style="{StaticResource ScrollBarThumbVertical}" Width="8" />
  204. </Track.Thumb>
  205. </Track>
  206. </Grid>
  207. </ControlTemplate>
  208. </Setter.Value>
  209. </Setter>
  210. </Style>
  211. </ListView.Resources>
  212. </ListView>
  213. <Label Content="{Binding WXContact.NickName}" HorizontalAlignment="Left" Margin="258,21,0,0" VerticalAlignment="Top"/>
  214. <ListView x:Name="list_msg" Margin="230,60,0,60" Background="Transparent" BorderThickness="0,1,0,1" BorderBrush="#BB2775b6" ItemTemplateSelector="{StaticResource MsgTemplateSelector}" ItemsSource="{Binding WXMsgs}" ScrollViewer.ScrollChanged="list_msg_ScrollChanged" >
  215. </ListView>
  216. <ComboBox Name="cb_export" Width="120" Height="30" Style="{StaticResource ComboBoxStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="30,15" ItemsSource="{Binding ExportItems}" SelectedItem="{Binding SelectExportItem}" DisplayMemberPath="Name" SelectedValuePath="Value" IsEnabled="{Binding SelectContact}" Background="#2775b6" />
  217. <Button x:Name="btn_open_workspace" Width="80" Height="30" Style="{StaticResource ButtonStyle}" Content="打开文件夹" BorderBrush="Transparent" BorderThickness="0" Background="#2775b6" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,390,15" Click="btn_open_workspace_Click">
  218. <Button.Resources>
  219. <Style TargetType="{x:Type Border}">
  220. <Setter Property="CornerRadius" Value="3"/>
  221. </Style>
  222. </Button.Resources>
  223. </Button>
  224. <Button x:Name="btn_pre_emoji" Width="80" Height="30" Style="{StaticResource ButtonStyle}" Content="表情预下载" BorderBrush="Transparent" BorderThickness="0" Background="#2775b6" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,292,15" IsEnabled="{Binding SelectContact}" Click="btn_pre_emoji_Click" >
  225. <Button.Resources>
  226. <Style TargetType="{x:Type Border}">
  227. <Setter Property="CornerRadius" Value="3"/>
  228. </Style>
  229. </Button.Resources>
  230. </Button>
  231. <Label Content="{Binding ExportCount}" HorizontalAlignment="Right" Margin="0,0,160,15" VerticalAlignment="Bottom"/>
  232. </Grid>
  233. </Page>