TradeParamSetView.xaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <Window x:Class="Muchinfo.MTPClient.Account.Views.TradeParamSetView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:converters="clr-namespace:Muchinfo.MTPClient.Infrastructure.Converters;assembly=Client.Infrastructure"
  5. xmlns:dataGrid="clr-namespace:Muchinfo.WPF.Controls.DataGrid;assembly=Client.WPF.Controls"
  6. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:resource="clr-namespace:Muchinfo.MTPClient.Resources;assembly=Client.Resources"
  8. x:Name="openOrderWindow"
  9. Width="500"
  10. Height="400"
  11. ShowInTaskbar="False"
  12. Style="{DynamicResource TradeDialogWindowStyle}"
  13. WindowStartupLocation="CenterOwner">
  14. <Window.Resources>
  15. <converters:EnumVisibilityConvert x:Key="EnumVisibilityConvert" />
  16. <Style TargetType="TextBlock">
  17. <Setter Property="HorizontalAlignment" Value="Right" />
  18. <Setter Property="VerticalAlignment" Value="Center" />
  19. </Style>
  20. </Window.Resources>
  21. <!-- 总算知道为什么xaml里,看到的界面都是重叠,乱的,因为动态绑定的问题,界面就是这调用的 -->
  22. <Grid>
  23. <!-- 交易参数设置 -->
  24. <Grid Margin="10,20" Visibility="{Binding SettingTadIndex, Converter={StaticResource EnumVisibilityConvert}, ConverterParameter=0}">
  25. <Grid.ColumnDefinitions>
  26. <ColumnDefinition Width="170" />
  27. <ColumnDefinition />
  28. </Grid.ColumnDefinitions>
  29. <Grid.RowDefinitions>
  30. <RowDefinition />
  31. <RowDefinition />
  32. <RowDefinition />
  33. <RowDefinition />
  34. <RowDefinition />
  35. <RowDefinition />
  36. </Grid.RowDefinitions>
  37. <TextBlock Text="{x:Static resource:Client_Resource.Content_IsOrderComfrim}" />
  38. <TextBlock Grid.Row="1" Text="{x:Static resource:Client_Resource.Content_SuccessCloseWin}" />
  39. <TextBlock Grid.Row="2" Text="{x:Static resource:Client_Resource.Content_CancelComfrim}" />
  40. <TextBlock Grid.Row="3" Text="{x:Static resource:Client_Resource.Content_LockScreenTime}" />
  41. <ComboBox Grid.Column="1"
  42. Width="200"
  43. Margin="20,0,0,0"
  44. HorizontalAlignment="Left"
  45. VerticalAlignment="Center"
  46. DisplayMemberPath="Value"
  47. ItemsSource="{Binding OrderComfrimItems}"
  48. SelectedValue="{Binding TradeParams.IsOrderComfrim,
  49. Mode=TwoWay}"
  50. SelectedValuePath="Key"
  51. Style="{DynamicResource SimpleComboBoxStyle}"
  52. TabIndex="1" />
  53. <ComboBox Grid.Row="1"
  54. Grid.Column="1"
  55. Width="200"
  56. Margin="20,0,0,0"
  57. HorizontalAlignment="Left"
  58. VerticalAlignment="Center"
  59. DisplayMemberPath="Value"
  60. ItemsSource="{Binding SuccessItems}"
  61. SelectedValue="{Binding TradeParams.IsSuccessComfrim,
  62. Mode=TwoWay}"
  63. SelectedValuePath="Key"
  64. Style="{DynamicResource SimpleComboBoxStyle}"
  65. TabIndex="2" />
  66. <ComboBox Grid.Row="2"
  67. Grid.Column="1"
  68. Width="200"
  69. Margin="20,0,0,0"
  70. HorizontalAlignment="Left"
  71. VerticalAlignment="Center"
  72. DisplayMemberPath="Value"
  73. ItemsSource="{Binding CancelItems}"
  74. SelectedValue="{Binding TradeParams.IsCancelComfrim,
  75. Mode=TwoWay}"
  76. SelectedValuePath="Key"
  77. Style="{DynamicResource SimpleComboBoxStyle}"
  78. TabIndex="3" />
  79. <ComboBox Grid.Row="3"
  80. Grid.Column="1"
  81. Width="200"
  82. Margin="20,0,0,0"
  83. HorizontalAlignment="Left"
  84. VerticalAlignment="Center"
  85. DisplayMemberPath="Value"
  86. ItemsSource="{Binding LockScreenItems}"
  87. SelectedValue="{Binding TradeParams.LockScreenTime,
  88. Mode=TwoWay}"
  89. SelectedValuePath="Key"
  90. Style="{DynamicResource SimpleComboBoxStyle}"
  91. TabIndex="4" />
  92. <StackPanel Grid.Row="4"
  93. Grid.RowSpan="2"
  94. Grid.ColumnSpan="2"
  95. HorizontalAlignment="Center"
  96. Orientation="Horizontal">
  97. <Button Width="82"
  98. Height="26"
  99. Command="{Binding OKCommand}"
  100. CommandParameter="{Binding ElementName=openOrderWindow}"
  101. Content="{x:Static resource:Client_Resource.Button_Confirm}"
  102. IsDefault="True"
  103. IsEnabled="{Binding OKButtonEnabled}"
  104. Style="{DynamicResource CommonButtonStyle}"
  105. TabIndex="5" />
  106. <Button Width="82"
  107. Height="26"
  108. Margin="60,0,0,0"
  109. Command="{Binding CancelCommand}"
  110. CommandParameter="{Binding ElementName=openOrderWindow}"
  111. Content="{x:Static resource:Client_Resource.Button_Cancel}"
  112. Style="{DynamicResource CommonButtonStyle}"
  113. TabIndex="6" />
  114. </StackPanel>
  115. </Grid>
  116. <!-- 自动指引止损 -->
  117. <Grid x:Name="AutoEntrust" Visibility="{Binding SettingTadIndex, Converter={StaticResource EnumVisibilityConvert}, ConverterParameter=1}">
  118. <Grid.RowDefinitions>
  119. <RowDefinition Height="30" />
  120. <RowDefinition Height="Auto" />
  121. <RowDefinition Height="50" />
  122. </Grid.RowDefinitions>
  123. <TextBlock x:Name="AutoEntrustTips"
  124. Grid.ColumnSpan="4"
  125. Margin="15,0,0,0"
  126. HorizontalAlignment="Left"
  127. Background="Transparent"
  128. Foreground="White"
  129. Text="开仓后,在成交价基础上按设置的调整价位止盈止损,0代表不使用此功能。"
  130. TextWrapping="Wrap" />
  131. <!-- 商品列表咯 -->
  132. <dataGrid:MuchinfoDataGrid Grid.Row="1"
  133. Height="250"
  134. Margin="15,0,15,0"
  135. BorderBrush="#666666"
  136. BorderThickness="1"
  137. ItemsSource="{Binding AllGoodsForAutoEntrustModel}"
  138. ScrollViewer.HorizontalScrollBarVisibility="Hidden"
  139. ScrollViewer.VerticalScrollBarVisibility="Hidden"
  140. SelectedItem="{Binding CurrentGoodsForAutoEntrustModel}"
  141. SelectionMode="Single"
  142. Style="{DynamicResource AutoEntrustDataGridStyle}">
  143. <i:Interaction.Triggers>
  144. <i:EventTrigger EventName="MouseLeftButtonDown">
  145. <i:InvokeCommandAction Command="{Binding SelectItemCommand}" />
  146. </i:EventTrigger>
  147. </i:Interaction.Triggers>
  148. <DataGrid.Columns>
  149. <!-- 商品/代码 -->
  150. <DataGridTextColumn Width="Auto"
  151. MinWidth="180"
  152. ElementStyle="{StaticResource DataGridTextColumnStyle}"
  153. Header="{x:Static resource:Client_Resource.Content_Goods}"
  154. SortMemberPath="GoodsCode">
  155. <DataGridTextColumn.Binding>
  156. <MultiBinding StringFormat="{}{0} {1}">
  157. <Binding Path="GoodsName" />
  158. <Binding Path="GoodsCode" />
  159. </MultiBinding>
  160. </DataGridTextColumn.Binding>
  161. </DataGridTextColumn>
  162. <!-- 方向 -->
  163. <DataGridTextColumn Width="Auto"
  164. MinWidth="50"
  165. Binding="{Binding DirectionString}"
  166. ElementStyle="{StaticResource DataGridTextColumnStyleLeft}"
  167. Header="{x:Static resource:Client_Resource.Content_Direction}" />
  168. <!-- 止损 -->
  169. <DataGridTemplateColumn Width="Auto" MinWidth="100">
  170. <DataGridTemplateColumn.Header>
  171. <TextBlock Text="{x:Static resource:Client_Resource.Trade_Content_SlStrategy}" />
  172. </DataGridTemplateColumn.Header>
  173. <DataGridTemplateColumn.CellTemplate>
  174. <DataTemplate>
  175. <TextBox Width="80"
  176. Height="30"
  177. HorizontalAlignment="Center"
  178. VerticalAlignment="Center"
  179. HorizontalContentAlignment="Center"
  180. Background="Black"
  181. BorderBrush="#666666"
  182. BorderThickness="1"
  183. Foreground="White"
  184. Padding="1"
  185. Text="{Binding Loss}"
  186. TextChanged="TextBoxBase_SL_OnTextChanged" />
  187. </DataTemplate>
  188. </DataGridTemplateColumn.CellTemplate>
  189. </DataGridTemplateColumn>
  190. <!-- 止盈 -->
  191. <DataGridTemplateColumn Width="Auto" MinWidth="100">
  192. <DataGridTemplateColumn.Header>
  193. <TextBlock Text="{x:Static resource:Client_Resource.Trade_Content_SpStrategy}" />
  194. </DataGridTemplateColumn.Header>
  195. <DataGridTemplateColumn.CellTemplate>
  196. <DataTemplate>
  197. <TextBox Width="80"
  198. Height="30"
  199. HorizontalAlignment="Center"
  200. VerticalAlignment="Center"
  201. HorizontalContentAlignment="Center"
  202. Background="Black"
  203. BorderBrush="#666666"
  204. BorderThickness="1"
  205. Foreground="White"
  206. Padding="1"
  207. Text="{Binding Profit}"
  208. TextChanged="TextBoxBase_SP_OnTextChanged" />
  209. </DataTemplate>
  210. </DataGridTemplateColumn.CellTemplate>
  211. </DataGridTemplateColumn>
  212. </DataGrid.Columns>
  213. </dataGrid:MuchinfoDataGrid>
  214. <StackPanel Grid.Row="2"
  215. HorizontalAlignment="Center"
  216. Orientation="Horizontal">
  217. <Button Width="82"
  218. Height="26"
  219. Command="{Binding SetAutoCommand}"
  220. CommandParameter="{Binding ElementName=openOrderWindow}"
  221. Content="{x:Static resource:Client_Resource.Button_Update}"
  222. IsDefault="True"
  223. Style="{DynamicResource CommonButtonStyle}" />
  224. <Button Width="82"
  225. Height="26"
  226. Margin="50,0,0,0"
  227. Command="{Binding ResetCommand}"
  228. CommandParameter="{Binding ElementName=openOrderWindow}"
  229. Content="{x:Static resource:Client_Resource.All_Reset}"
  230. IsDefault="True"
  231. Style="{DynamicResource CommonButtonStyle}" />
  232. <Button Width="82"
  233. Height="26"
  234. Margin="50,0,0,0"
  235. Command="{Binding CancelCommand}"
  236. CommandParameter="{Binding ElementName=openOrderWindow}"
  237. Content="{x:Static resource:Client_Resource.Button_Cancel}"
  238. Style="{DynamicResource CommonButtonStyle}" />
  239. </StackPanel>
  240. </Grid>
  241. </Grid>
  242. </Window>