QuoteBoardView.xaml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <UserControl x:Class="Muchinfo.MTPClient.Quotation.Views.QuoteBoardView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:border="clr-namespace:Muchinfo.WPF.Controls.Border;assembly=Client.WPF.Controls"
  5. xmlns:controls="clr-namespace:Muchinfo.WPF.Controls;assembly=Client.WPF.Controls"
  6. xmlns:converters="clr-namespace:Muchinfo.MTPClient.Infrastructure.Converters;assembly=Client.Infrastructure"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:dataGrid="clr-namespace:Muchinfo.WPF.Controls.DataGrid;assembly=Client.WPF.Controls"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:resource="clr-namespace:Muchinfo.MTPClient.Resources;assembly=Client.Resources"
  11. xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
  12. x:Name="view"
  13. d:DesignHeight="300"
  14. d:DesignWidth="300"
  15. mc:Ignorable="d">
  16. <UserControl.Resources>
  17. <converters:IncreaseValueToVisibilityConverter x:Key="increaseValueToVisibilityConverter" />
  18. <converters:TradeModeVisibilityConverter x:Key="tradeModeVisibilityConverter" />
  19. <converters:FontSizeByLengthConverter x:Key="fontSizeByLengthConverter" />
  20. <converters:EnumVisibilityConvert x:Key="EnumVisibilityConvert" />
  21. <BooleanToVisibilityConverter x:Key="ToVisibilityConverter" />
  22. <Style x:Key="BoardListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  23. <Setter Property="Background" Value="Transparent" />
  24. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  25. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  26. <Setter Property="Padding" Value="2" />
  27. <Setter Property="Margin" Value="2" />
  28. <Setter Property="FontSize" Value="{DynamicResource MuchinfoFontSize_S}" />
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  32. <Border x:Name="Bd"
  33. Width="256"
  34. Height="150"
  35. BorderBrush="{DynamicResource MuchinfoBrush114}"
  36. BorderThickness="1"
  37. CornerRadius="0"
  38. Padding="{TemplateBinding Padding}"
  39. SnapsToDevicePixels="true">
  40. <!-- 使用Effect后在Windows XP上显示不了背景 -->
  41. <!--
  42. <Border.Effect>
  43. <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
  44. </Border.Effect>
  45. -->
  46. <Border.Background>
  47. <ImageBrush ImageSource="{DynamicResource QuoteBoardBackgroundImageSource}" />
  48. </Border.Background>
  49. <Grid Width="252" Height="150">
  50. <Grid.ColumnDefinitions>
  51. <ColumnDefinition SharedSizeGroup="SingleWidthColumn" />
  52. </Grid.ColumnDefinitions>
  53. <Grid.Style>
  54. <Style>
  55. <Setter Property="TextBlock.Foreground" Value="Transparent" />
  56. </Style>
  57. </Grid.Style>
  58. <Canvas Width="252" Height="150">
  59. <!-- Region 第一行:商品名+时间 -->
  60. <Grid Width="245"
  61. Margin="3,2,2,0"
  62. HorizontalAlignment="Stretch">
  63. <Grid.ColumnDefinitions>
  64. <ColumnDefinition Width="2*" />
  65. <ColumnDefinition Width="*" />
  66. </Grid.ColumnDefinitions>
  67. <TextBlock Grid.Column="0"
  68. VerticalAlignment="Center"
  69. FontWeight="Bold"
  70. Foreground="{DynamicResource NameDefaultBrush}"
  71. Text="{Binding CodeNameDisplay}"
  72. TextTrimming="CharacterEllipsis"
  73. TextWrapping="NoWrap"
  74. ToolTip="{Binding CodeNameDisplay}" />
  75. <TextBlock Grid.Column="1"
  76. HorizontalAlignment="Right"
  77. VerticalAlignment="Center"
  78. Foreground="{DynamicResource MuchinfoBrush112}"
  79. Text="{Binding DateDisplay}"
  80. TextTrimming="CharacterEllipsis"
  81. ToolTip="{Binding DateDisplay}" />
  82. </Grid>
  83. <!-- EndRegion -->
  84. <!-- Region 第二行:开、高、低、收 -->
  85. <Grid Canvas.Left="2"
  86. Canvas.Top="25"
  87. Width="245"
  88. Height="42"
  89. HorizontalAlignment="Stretch">
  90. <Grid.RowDefinitions>
  91. <RowDefinition Height="*" />
  92. <RowDefinition Height="2" />
  93. <RowDefinition Height="*" />
  94. </Grid.RowDefinitions>
  95. <Grid.ColumnDefinitions>
  96. <ColumnDefinition Width="Auto" />
  97. <ColumnDefinition Width="*" />
  98. <ColumnDefinition Width="Auto" />
  99. <ColumnDefinition Width="Auto" />
  100. <ColumnDefinition Width="*" />
  101. </Grid.ColumnDefinitions>
  102. <TextBlock Grid.Row="0"
  103. Grid.Column="0"
  104. Margin="1,1"
  105. VerticalAlignment="Center"
  106. Foreground="{DynamicResource MuchinfoBrush113}"
  107. Text="{x:Static resource:Client_Resource.QuoteBoard_Open}" />
  108. <TextBlock Grid.Row="0"
  109. Grid.Column="1"
  110. Margin="1,1"
  111. HorizontalAlignment="Right"
  112. VerticalAlignment="Center"
  113. Foreground="{Binding OpenColor}"
  114. Text="{Binding OpenDisplay}" />
  115. <Border Grid.Row="0"
  116. Grid.Column="2"
  117. Width="55"
  118. Height="16"
  119. Margin="1,1"
  120. VerticalAlignment="Center"
  121. Background="{DynamicResource MuchinfoBrush115}"
  122. BorderThickness="0"
  123. CornerRadius="2"
  124. Padding="2,0">
  125. <TextBlock HorizontalAlignment="Center"
  126. VerticalAlignment="Center"
  127. Foreground="{Binding IncreaseValueColor}"
  128. Text="{Binding IncreaseValueDisplay}"
  129. ToolTip="{Binding IncreaseValueDisplay}" />
  130. </Border>
  131. <TextBlock Grid.Row="0"
  132. Grid.Column="3"
  133. Margin="1,1"
  134. VerticalAlignment="Center"
  135. Foreground="{DynamicResource MuchinfoBrush113}"
  136. Text="{x:Static resource:Client_Resource.QuoteBoard_Close}" />
  137. <TextBlock Grid.Row="0"
  138. Grid.Column="4"
  139. Margin="1,1"
  140. HorizontalAlignment="Right"
  141. VerticalAlignment="Center"
  142. Foreground="{DynamicResource MuchinfoBrush113}"
  143. Text="{Binding LastCloseDisplay}" />
  144. <TextBlock Grid.Row="2"
  145. Grid.Column="0"
  146. Margin="1,1"
  147. VerticalAlignment="Center"
  148. Foreground="{DynamicResource MuchinfoBrush113}"
  149. Text="{x:Static resource:Client_Resource.QuoteBoard_Low}" />
  150. <TextBlock Grid.Row="2"
  151. Grid.Column="1"
  152. Margin="1,1"
  153. HorizontalAlignment="Right"
  154. VerticalAlignment="Center"
  155. Foreground="{Binding LowColor}"
  156. Text="{Binding LowDisplay}" />
  157. <Border Grid.Row="2"
  158. Grid.Column="2"
  159. Width="55"
  160. Height="16"
  161. Margin="1,1"
  162. VerticalAlignment="Center"
  163. Background="{DynamicResource MuchinfoBrush115}"
  164. BorderThickness="0"
  165. CornerRadius="2">
  166. <TextBlock HorizontalAlignment="Center"
  167. VerticalAlignment="Center"
  168. Foreground="{Binding IncreasePercentColor}"
  169. Text="{Binding IncreasePercentDisplay}"
  170. ToolTip="{Binding IncreasePercentDisplay}" />
  171. </Border>
  172. <TextBlock Grid.Row="2"
  173. Grid.Column="3"
  174. Margin="1,1"
  175. VerticalAlignment="Center"
  176. Foreground="{DynamicResource MuchinfoBrush113}"
  177. Text="{x:Static resource:Client_Resource.QuoteBoard_High}" />
  178. <TextBlock Grid.Row="2"
  179. Grid.Column="4"
  180. Margin="1,1"
  181. HorizontalAlignment="Right"
  182. VerticalAlignment="Center"
  183. Foreground="{Binding HighColor}"
  184. Text="{Binding HighDisplay}" />
  185. </Grid>
  186. <!-- EndRegion -->
  187. <!-- Region 第三行:买卖价(OTC + 竞价) -->
  188. <Grid Canvas.Left="5"
  189. Canvas.Top="74"
  190. Width="240"
  191. Height="35"
  192. HorizontalAlignment="Stretch">
  193. <Grid.ColumnDefinitions>
  194. <ColumnDefinition Width="Auto" />
  195. <ColumnDefinition Width="*" />
  196. <ColumnDefinition Width="Auto" />
  197. </Grid.ColumnDefinitions>
  198. <Grid Grid.Column="1">
  199. <Path x:Name="UpArrow"
  200. Width="16"
  201. Height="20"
  202. Margin="0,-4,0,0"
  203. Data="F1M10.895,18.001C10.895,18.001 10.895,9.61 10.895,9.61 10.895,9.61 14.001,9.61 14.001,9.61 14.001,9.61 8,1.998 8,1.998 8,1.998 1.999,9.61 1.999,9.61 1.999,9.61 5.105,9.61 5.105,9.61 5.105,9.61 5.105,18.001 5.105,18.001 5.105,18.001 10.895,18.001 10.895,18.001z"
  204. Fill="{DynamicResource MuchinfoBrush122}"
  205. RenderTransformOrigin="0.438,-2.803"
  206. Visibility="{Binding IncreaseValue,
  207. ConverterParameter=1,
  208. Converter={StaticResource increaseValueToVisibilityConverter}}" />
  209. <Path x:Name="DownArrow"
  210. Width="16"
  211. Height="20"
  212. Margin="0,-4,0,0"
  213. Data="F1M5.105,1.998C5.105,1.998 5.105,10.39 5.105,10.39 5.105,10.39 1.999,10.39 1.999,10.39 1.999,10.39 8,18.001 8,18.001 8,18.001 14.001,10.39 14.001,10.39 14.001,10.39 10.895,10.39 10.895,10.39 10.895,10.39 10.895,1.998 10.895,1.998 10.895,1.998 5.105,1.998 5.105,1.998z"
  214. Fill="{DynamicResource MuchinfoBrush123}"
  215. Visibility="{Binding IncreaseValue,
  216. ConverterParameter=2,
  217. Converter={StaticResource increaseValueToVisibilityConverter}}" />
  218. </Grid>
  219. <!-- Region OTC -->
  220. <border:ExpBorder Grid.Column="0"
  221. Width="100"
  222. BorderThickness="2"
  223. ChangeBrush="{Binding BidPriceColor}"
  224. IsBorderThickness="False"
  225. IsVauleChange="{Binding IsBidPriceBorder}"
  226. Visibility="{Binding TradeMode,
  227. ConverterParameter=0,
  228. Converter={StaticResource tradeModeVisibilityConverter}}">
  229. <TextBlock HorizontalAlignment="Center"
  230. VerticalAlignment="Center"
  231. FontSize="{Binding BidPriceDisplay,
  232. Converter={StaticResource fontSizeByLengthConverter}}"
  233. FontWeight="Bold"
  234. Foreground="{Binding BidPriceColor}"
  235. IsHyphenationEnabled="True"
  236. LineStackingStrategy="BlockLineHeight"
  237. Text="{Binding BidPriceDisplay}"
  238. TextAlignment="Center"
  239. TextWrapping="Wrap"
  240. Visibility="{Binding TradeMode,
  241. ConverterParameter=0,
  242. Converter={StaticResource tradeModeVisibilityConverter}}" />
  243. </border:ExpBorder>
  244. <border:ExpBorder Grid.Column="2"
  245. Width="100"
  246. BorderThickness="2"
  247. ChangeBrush="{Binding AskPriceColor}"
  248. IsBorderThickness="False"
  249. IsVauleChange="{Binding IsAskPriceBorder}"
  250. Visibility="{Binding TradeMode,
  251. ConverterParameter=0,
  252. Converter={StaticResource tradeModeVisibilityConverter}}">
  253. <TextBlock HorizontalAlignment="Center"
  254. VerticalAlignment="Center"
  255. FontSize="{Binding AskPriceDisplay,
  256. Converter={StaticResource fontSizeByLengthConverter}}"
  257. FontWeight="Bold"
  258. Foreground="{Binding AskPriceColor}"
  259. IsHyphenationEnabled="True"
  260. LineStackingStrategy="BlockLineHeight"
  261. Text="{Binding AskPriceDisplay}"
  262. TextAlignment="Center"
  263. TextWrapping="Wrap"
  264. Visibility="{Binding TradeMode,
  265. ConverterParameter=0,
  266. Converter={StaticResource tradeModeVisibilityConverter}}" />
  267. </border:ExpBorder>
  268. <!-- EndRegion -->
  269. <!-- Region IsBidMarket -->
  270. <border:ExpBorder Grid.Column="0"
  271. Width="100"
  272. BorderThickness="2"
  273. ChangeBrush="{Binding AskPriceColor}"
  274. IsBorderThickness="False"
  275. IsVauleChange="{Binding IsAskPriceBorder}"
  276. Visibility="{Binding TradeMode,
  277. ConverterParameter=1,
  278. Converter={StaticResource tradeModeVisibilityConverter}}">
  279. <TextBlock HorizontalAlignment="Center"
  280. VerticalAlignment="Center"
  281. FontSize="{Binding AskPriceDisplay,
  282. Converter={StaticResource fontSizeByLengthConverter}}"
  283. FontWeight="Bold"
  284. Foreground="{Binding AskPriceColor}"
  285. IsHyphenationEnabled="True"
  286. LineStackingStrategy="BlockLineHeight"
  287. Text="{Binding AskPriceDisplay}"
  288. TextAlignment="Center"
  289. TextWrapping="Wrap"
  290. Visibility="{Binding TradeMode,
  291. ConverterParameter=1,
  292. Converter={StaticResource tradeModeVisibilityConverter}}" />
  293. </border:ExpBorder>
  294. <border:ExpBorder Grid.Column="2"
  295. Width="100"
  296. BorderThickness="2"
  297. ChangeBrush="{Binding BidPriceColor}"
  298. IsBorderThickness="False"
  299. IsVauleChange="{Binding IsBidPriceBorder}"
  300. Visibility="{Binding TradeMode,
  301. ConverterParameter=1,
  302. Converter={StaticResource tradeModeVisibilityConverter}}">
  303. <TextBlock HorizontalAlignment="Center"
  304. VerticalAlignment="Center"
  305. FontSize="{Binding BidPriceDisplay,
  306. Converter={StaticResource fontSizeByLengthConverter}}"
  307. FontWeight="Bold"
  308. Foreground="{Binding BidPriceColor}"
  309. IsHyphenationEnabled="True"
  310. LineStackingStrategy="BlockLineHeight"
  311. Text="{Binding BidPriceDisplay}"
  312. TextAlignment="Center"
  313. TextWrapping="Wrap"
  314. Visibility="{Binding TradeMode,
  315. ConverterParameter=1,
  316. Converter={StaticResource tradeModeVisibilityConverter}}" />
  317. </border:ExpBorder>
  318. <!-- EndRegion -->
  319. </Grid>
  320. <!-- EndRegion -->
  321. <!-- Region 第四行 买卖按钮 -->
  322. <Grid Canvas.Left="2"
  323. Canvas.Top="111"
  324. Width="250"
  325. Height="28"
  326. HorizontalAlignment="Stretch">
  327. <Grid.ColumnDefinitions>
  328. <ColumnDefinition Width="Auto" />
  329. <ColumnDefinition Width="Auto" />
  330. <ColumnDefinition Width="*" />
  331. </Grid.ColumnDefinitions>
  332. <Button Grid.Column="0"
  333. Width="89"
  334. Height="26"
  335. Margin="2,0,0,0"
  336. Command="{Binding DataContext.BuyCommand,
  337. ElementName=view}"
  338. CommandParameter="{Binding}"
  339. Content="{x:Static resource:Client_Resource.Market_Open_bid}"
  340. Cursor="Hand"
  341. FontSize="12"
  342. IsEnabled="{Binding DataContext.IsBidEnable,
  343. ElementName=view}"
  344. Padding="10,3"
  345. Style="{StaticResource CommonButtonStyle}" />
  346. <controls:DecimalNumBox Grid.Column="1"
  347. Width="54"
  348. Height="24"
  349. Margin="5,0,0,0"
  350. VerticalAlignment="Center"
  351. DecimalCount="4"
  352. DefaultValue="{Binding MinOpenNumber,
  353. Mode=OneTime}"
  354. DisplayDefaultValueOnEmptyText="True"
  355. Increment="{Binding MinOpenNumber}"
  356. Minimum="{Binding MinOpenNumber,
  357. Mode=OneWay}"
  358. Style="{DynamicResource DecimalUpDownStyle}"
  359. Value="{Binding Lot,
  360. Mode=TwoWay}" />
  361. <Button x:Name="SellButton"
  362. Grid.Column="2"
  363. Width="89"
  364. Height="26"
  365. Margin="1,0,2,0"
  366. Background="{DynamicResource QuoteBroadSellBrush}"
  367. Command="{Binding DataContext.SellCommand,
  368. ElementName=view}"
  369. CommandParameter="{Binding}"
  370. Content="{x:Static resource:Client_Resource.Market_Open_Ask}"
  371. Cursor="Hand"
  372. FontSize="12"
  373. IsEnabled="{Binding DataContext.IsAskEnable,
  374. ElementName=view}"
  375. Padding="10,3"
  376. Style="{StaticResource SellConentButtonStyle}" />
  377. </Grid>
  378. <!-- EndRegion -->
  379. </Canvas>
  380. </Grid>
  381. </Border>
  382. <ControlTemplate.Triggers>
  383. <Trigger Property="IsSelected" Value="true">
  384. <Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource MuchinfoBrush117}" />
  385. <!--
  386. <Setter TargetName="Bd" Property="BorderThickness" Value="2" />
  387. <Setter TargetName="UpArrow" Property="Margin" Value="-2,-5,0,0" />
  388. <Setter TargetName="DownArrow" Property="Margin" Value="-2,-4,0,0" />
  389. -->
  390. </Trigger>
  391. <Trigger Property="IsEnabled" Value="false">
  392. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  393. </Trigger>
  394. </ControlTemplate.Triggers>
  395. </ControlTemplate>
  396. </Setter.Value>
  397. </Setter>
  398. </Style>
  399. </UserControl.Resources>
  400. <Grid>
  401. <Grid.RowDefinitions>
  402. <RowDefinition Height="2*" />
  403. <RowDefinition Height="Auto" />
  404. </Grid.RowDefinitions>
  405. <ListBox x:Name="QuoteListBox"
  406. Margin="1"
  407. Background="{DynamicResource MuchinfoBrush118}"
  408. BorderThickness="0"
  409. Focusable="True"
  410. Grid.IsSharedSizeScope="True"
  411. ItemContainerStyle="{StaticResource BoardListBoxItemStyle}"
  412. ItemsSource="{Binding ItemsSource}"
  413. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  414. ScrollViewer.VerticalScrollBarVisibility="Auto"
  415. SelectedIndex="0"
  416. SelectionMode="Single"
  417. SnapsToDevicePixels="True">
  418. <ListBox.ItemsPanel>
  419. <ItemsPanelTemplate>
  420. <WrapPanel />
  421. </ItemsPanelTemplate>
  422. </ListBox.ItemsPanel>
  423. </ListBox>
  424. <!--
  425. {Binding IsVisibilityGoodsOfPAndX,
  426. Converter={StaticResource ToVisibilityConverter}}
  427. -->
  428. <StackPanel Grid.Row="1"
  429. Height="Auto"
  430. Visibility="Collapsed">
  431. <StackPanel Visibility="{Binding RelationMode, Converter={StaticResource EnumVisibilityConvert}, ConverterParameter=0}">
  432. <TextBlock Margin="5,5,0,5"
  433. HorizontalAlignment="Left"
  434. VerticalAlignment="Center"
  435. Foreground="{StaticResource TextBrush_Common}"
  436. Text="{x:Static resource:Client_Resource.QuoteBoardView_DeliveryGoodsInfo_property_N}" />
  437. </StackPanel>
  438. <StackPanel Visibility="{Binding RelationMode, Converter={StaticResource EnumVisibilityConvert}, ConverterParameter=1}">
  439. <TextBlock Margin="5,5,0,5"
  440. HorizontalAlignment="Left"
  441. VerticalAlignment="Center"
  442. Foreground="{StaticResource TextBrush_Common}"
  443. Text="{x:Static resource:Client_Resource.QuoteBoardView_DeliveryGoodsInfo_property_P}" />
  444. <StackPanel Height="25" Background="{DynamicResource AcountGridHeadBackground}">
  445. <TextBlock Margin="10,5,0,0" Foreground="{DynamicResource AcountGridHeadForeground}">
  446. <Run Text="{x:Static resource:Client_Resource.DeliveryOrderView_DeliveryGoods}" />
  447. <Run Text=":" />
  448. <Run Text="{Binding PDeliveryGoodsName}" />
  449. </TextBlock>
  450. </StackPanel>
  451. </StackPanel>
  452. <StackPanel Visibility="{Binding RelationMode, Converter={StaticResource EnumVisibilityConvert}, ConverterParameter=2}">
  453. <TextBlock Margin="5,5,0,5"
  454. HorizontalAlignment="Left"
  455. VerticalAlignment="Center"
  456. Foreground="{StaticResource TextBrush_Common}"
  457. Text="{x:Static resource:Client_Resource.QuoteBoardView_DeliveryGoodsInfo_property_PX}" />
  458. <dataGrid:MuchinfoDataGrid x:Name="PAndXGoodsInfoDataGrid"
  459. GridLinesVisibility="None"
  460. ItemsSource="{Binding GoodsOfPandXInfoList}"
  461. ScrollViewer.HorizontalScrollBarVisibility="Auto"
  462. ScrollViewer.VerticalScrollBarVisibility="Auto"
  463. Style="{DynamicResource QuoteMuchinfoDataGridStyle}" />
  464. </StackPanel>
  465. </StackPanel>
  466. </Grid>
  467. </UserControl>