MainWindow.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <Window x:Class="TranslateTool.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:TranslateTool"
  7. xmlns:views="clr-namespace:TranslateTool.Views"
  8. mc:Ignorable="d" Closed="Window_Closed"
  9. Title="翻译工具" Height="700" Width="800">
  10. <Window.Resources>
  11. <ResourceDictionary>
  12. <SolidColorBrush Color="#abd8fe" x:Key="ListItemSelecctedBlueBrush"/>
  13. <SolidColorBrush Color="#cfe8ff" x:Key="ListItemMoveOverBlueBrush"/>
  14. <Style TargetType="{x:Type ListBoxItem}" x:Key="ListBoxItemStyle">
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate>
  18. <Grid x:Name="Container" Height="25" Background="{TemplateBinding Background}">
  19. <Grid.ColumnDefinitions>
  20. <ColumnDefinition Width="30"></ColumnDefinition>
  21. <ColumnDefinition Width="Auto"></ColumnDefinition>
  22. </Grid.ColumnDefinitions>
  23. <TextBlock Grid.Column="0" Text="{Binding Path=Index}" VerticalAlignment="Center"/>
  24. <TextBlock Grid.Column="1" Text="{Binding Path=KeyValue}" Margin="10,0,0,0"
  25. VerticalAlignment="Center" TextAlignment="Left"/>
  26. </Grid>
  27. </ControlTemplate>
  28. </Setter.Value>
  29. </Setter>
  30. <Style.Triggers>
  31. <Trigger Property="IsMouseOver" Value="True">
  32. <Setter Property="Background" Value="{StaticResource ListItemMoveOverBlueBrush}"/>
  33. </Trigger>
  34. <Trigger Property="IsSelected" Value="True">
  35. <Setter Property="Background" Value="{StaticResource ListItemSelecctedBlueBrush}"/>
  36. </Trigger>
  37. </Style.Triggers>
  38. </Style>
  39. <Style TargetType="{x:Type ComboBoxItem}" x:Key="ComboxItemStyle">
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate>
  43. <Grid x:Name="Container" Height="25" Background="{TemplateBinding Background}">
  44. <Grid.ColumnDefinitions>
  45. <ColumnDefinition Width="*"/>
  46. <ColumnDefinition Width="25"/>
  47. </Grid.ColumnDefinitions>
  48. <TextBlock Grid.Column="0" Text="{Binding}" VerticalAlignment="Center" TextAlignment="Left"/>
  49. <views:ImageButton Grid.Column="1" ImageSource="Resources/Images/BlackClose.png"
  50. Command="{Binding DataContext.DeleteCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBox}}}" CommandParameter="{Binding}"/>
  51. </Grid>
  52. </ControlTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. <Style.Triggers>
  56. <Trigger Property="IsMouseOver" Value="True">
  57. <Setter Property="Background" Value="{StaticResource ListItemMoveOverBlueBrush}"/>
  58. </Trigger>
  59. <Trigger Property="IsSelected" Value="True">
  60. <Setter Property="Background" Value="{StaticResource ListItemSelecctedBlueBrush}"/>
  61. </Trigger>
  62. </Style.Triggers>
  63. </Style>
  64. <Style TargetType="{x:Type ComboBoxItem}" x:Key="FixedComboxItemStyle">
  65. <Setter Property="Template">
  66. <Setter.Value>
  67. <ControlTemplate>
  68. <StackPanel Orientation="Horizontal" Height="25" Background="{TemplateBinding Background}">
  69. <Image Source="Resources/Images/Add.png" Width="15" Margin="0 0 5 0" VerticalAlignment="Center"/>
  70. <TextBlock Text="添加" VerticalAlignment="Center" TextAlignment="Left"/>
  71. </StackPanel>
  72. </ControlTemplate>
  73. </Setter.Value>
  74. </Setter>
  75. <Style.Triggers>
  76. <Trigger Property="IsMouseOver" Value="True">
  77. <Setter Property="Background" Value="{StaticResource ListItemMoveOverBlueBrush}"/>
  78. </Trigger>
  79. <Trigger Property="IsSelected" Value="True">
  80. <Setter Property="Background" Value="{StaticResource ListItemSelecctedBlueBrush}"/>
  81. </Trigger>
  82. </Style.Triggers>
  83. </Style>
  84. <CollectionViewSource x:Key="ClientList" Source="{Binding ClientSource}" />
  85. <CollectionViewSource x:Key="LanguageList" Source="{Binding LanguageSource}" />
  86. </ResourceDictionary>
  87. </Window.Resources>
  88. <Grid Margin="20,20,0,20">
  89. <Grid.ColumnDefinitions >
  90. <ColumnDefinition Width="0.35*"/>
  91. <ColumnDefinition Width="0.65*"/>
  92. </Grid.ColumnDefinitions>
  93. <Grid Grid.Column="0">
  94. <Grid.RowDefinitions>
  95. <RowDefinition Height="Auto"/>
  96. <RowDefinition Height="10"/>
  97. <RowDefinition Height="25"/>
  98. <RowDefinition Height="10"/>
  99. <RowDefinition Height="*"/>
  100. <RowDefinition Height="10"/>
  101. <RowDefinition Height="30"/>
  102. </Grid.RowDefinitions>
  103. <CheckBox Grid.Row="0" Content="仅显示未翻译内容" IsChecked="{Binding ShowUntranslated}"/>
  104. <Grid Grid.Row="2">
  105. <Grid.ColumnDefinitions>
  106. <ColumnDefinition Width="*"/>
  107. <ColumnDefinition Width="Auto"/>
  108. </Grid.ColumnDefinitions>
  109. <TextBox Grid.Column="0" x:Name="SearchTxt" Text="{Binding SearchKey}"
  110. Margin="0,0,10,0" KeyDown="UIElement_OnKeyDown"/>
  111. <Button Grid.Column="1" Content="搜索" Width="50" Command="{Binding SearchCommand}"/>
  112. </Grid>
  113. <ListBox Grid.Row="4" x:Name="KeyList" ItemsSource="{Binding LanguageKeys}" SelectedItem="{Binding SelectKey}"
  114. ItemContainerStyle="{StaticResource ListBoxItemStyle}" />
  115. <TextBlock Grid.Row="6" Text="{Binding ItemInfo}" Margin="0,0,10,0"/>
  116. </Grid>
  117. <Grid Grid.Column="1" Margin="20,0,20,0">
  118. <Grid.RowDefinitions>
  119. <RowDefinition Height="25"/>
  120. <RowDefinition Height="40"/>
  121. <RowDefinition Height="0.3*"/>
  122. <RowDefinition Height="10"/>
  123. <RowDefinition Height="0.3*"/>
  124. <RowDefinition Height="10"/>
  125. <RowDefinition Height="35"/>
  126. <RowDefinition Height="10"/>
  127. <RowDefinition Height="35"/>
  128. </Grid.RowDefinitions>
  129. <Grid.ColumnDefinitions>
  130. <ColumnDefinition Width="80"/>
  131. <ColumnDefinition Width="*"/>
  132. </Grid.ColumnDefinitions>
  133. <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="2">
  134. <Grid.ColumnDefinitions>
  135. <ColumnDefinition Width="80"/>
  136. <ColumnDefinition Width="80"/>
  137. <ColumnDefinition Width="80"/>
  138. <ColumnDefinition Width="80"/>
  139. <ColumnDefinition Width="80"/>
  140. </Grid.ColumnDefinitions>
  141. <TextBox Grid.Column="2" Text="{Binding EnglishFileName}" TextAlignment="Center" VerticalContentAlignment="Center"/>
  142. <Button x:Name="SelectEnglishFile" Content="选择英文文件" Command="{Binding EnglishFileCommand}" HorizontalAlignment="Left" Grid.Column="1"></Button>
  143. <TextBox Grid.Column="5" Text="{Binding FileName}" TextAlignment="Center" VerticalContentAlignment="Center"/>
  144. <Button x:Name="SelectFile" Content="选择文件" Command="{Binding FileCommand}" HorizontalAlignment="Center" Grid.Column="3"></Button>
  145. </Grid>
  146. <TextBlock Grid.Row="2" Grid.Column="0" Text="文件内容"/>
  147. <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Content}" IsReadOnly="True"
  148. TextWrapping="Wrap" GotFocus="TextBox_GotFocus"/>
  149. <!--<TextBlock Grid.Row="4" Grid.Column="0" Text="翻译"/>
  150. <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding NewContent}" TextWrapping="Wrap"/>-->
  151. <!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
  152. Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2">
  153. <Button Content="导出Txt未翻译内容" x:Name="ExportFile" Margin="0,0,10,0" Width="110" Click="ExportFile_OnClick"/>
  154. <Button Content="导入已翻译内容" x:Name="ImportFile" Margin="0,0,10,0" Width="100" Click="ImportFile_OnClick"/>
  155. <Button Content="旧文件转化" x:Name="ConvertOldFile" Margin="0,0,10,0" Width="100" Click="ConvertOldFile_OnClick"/>
  156. <Button Content="导入最新文件" x:Name="ImportLatestFile" Width="100" Click="ImportLatestFile_OnClick"/>
  157. </StackPanel>-->
  158. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
  159. Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0">
  160. <Button Content="导出Excel未翻译内容" x:Name="ExportExcelFile" Margin="0,0,10,0" Width="120" Click="ExportExcelFile_Click"/>
  161. <Button Content="导入Excel已翻译内容" x:Name="ImportExcelFile" Margin="0,0,10,0" Width="120" Click="ImportExcelFile_Click"/>
  162. </StackPanel>
  163. </Grid>
  164. </Grid>
  165. </Window>