MainWindow.xaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <Window x:Class="MuchInfo.Chart.App.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:ct="clr-namespace:MuchInfo.Chart.App.Converters"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:mi="clr-namespace:MuchInfo.Chart.WPF;assembly=MuchInfo.Chart.WPF"
  9. xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
  10. Title="图表控件测试App (v1.0.0.2)"
  11. Background="White"
  12. DataContext="{Binding Main,
  13. Source={StaticResource Locator}}"
  14. WindowState="Maximized"
  15. mc:Ignorable="d">
  16. <Window.Resources>
  17. <ct:ColorConverter x:Key="colorConverter" />
  18. <ct:LanguageConverter x:Key="languageConverter" />
  19. <ct:ComparisonGoodsCommandConverter x:Key="comparisonGoodsCommandConverter" />
  20. </Window.Resources>
  21. <Grid>
  22. <Grid.ColumnDefinitions>
  23. <ColumnDefinition Width="Auto" />
  24. <ColumnDefinition Width="*" />
  25. </Grid.ColumnDefinitions>
  26. <GroupBox Grid.Column="0"
  27. Margin="3"
  28. Header="图表属性设置"
  29. Padding="5">
  30. <Grid>
  31. <Grid.ColumnDefinitions>
  32. <ColumnDefinition Width="Auto" />
  33. <ColumnDefinition Width="10" />
  34. <ColumnDefinition Width="*" />
  35. </Grid.ColumnDefinitions>
  36. <Grid.RowDefinitions>
  37. <RowDefinition Height="Auto" />
  38. <RowDefinition Height="Auto" />
  39. <RowDefinition Height="Auto" />
  40. <RowDefinition Height="Auto" />
  41. <RowDefinition Height="Auto" />
  42. <RowDefinition Height="Auto" />
  43. <RowDefinition Height="Auto" />
  44. <RowDefinition Height="Auto" />
  45. <RowDefinition Height="Auto" />
  46. <RowDefinition Height="Auto" />
  47. <RowDefinition Height="Auto" />
  48. <RowDefinition Height="Auto" />
  49. <RowDefinition Height="Auto" />
  50. <RowDefinition Height="Auto" />
  51. <RowDefinition Height="Auto" />
  52. <RowDefinition Height="Auto" />
  53. <RowDefinition Height="Auto" />
  54. <RowDefinition Height="Auto" />
  55. <RowDefinition Height="Auto" />
  56. <RowDefinition Height="Auto" />
  57. <RowDefinition Height="Auto" />
  58. <RowDefinition Height="Auto" />
  59. <RowDefinition Height="Auto" />
  60. </Grid.RowDefinitions>
  61. <TextBlock Grid.Row="0"
  62. Grid.Column="0"
  63. Text="语言环境:" />
  64. <ComboBox Grid.Row="0"
  65. Grid.Column="2"
  66. DisplayMemberPath="Value"
  67. ItemsSource="{Binding Languages}"
  68. SelectedItem="{Binding ChartLanguage,
  69. Mode=TwoWay,
  70. Converter={StaticResource languageConverter}}"
  71. SelectedValuePath="Key" />
  72. <TextBlock Grid.Row="1"
  73. Grid.Column="0"
  74. Text="图表背景色:" />
  75. <xctk:ColorPicker Grid.Row="1"
  76. Grid.Column="2"
  77. Width="100"
  78. SelectedColor="{Binding ChartBackground,
  79. Mode=TwoWay,
  80. Converter={StaticResource colorConverter}}"
  81. ShowAdvancedButton="True"
  82. ShowAvailableColors="True"
  83. ShowDropDownButton="True"
  84. ShowStandardColors="True"
  85. UsingAlphaChannel="True" />
  86. <TextBlock Grid.Row="2"
  87. Grid.Column="0"
  88. Text="图表字体大小:" />
  89. <xctk:SingleUpDown Grid.Row="2"
  90. Grid.Column="2"
  91. Width="100"
  92. Increment="1"
  93. Maximum="72"
  94. Minimum="12"
  95. Value="{Binding ChartFontSize,
  96. Mode=TwoWay}" />
  97. <TextBlock Grid.Row="3"
  98. Grid.Column="0"
  99. Text="网格透明度:" />
  100. <xctk:DoubleUpDown Grid.Row="3"
  101. Grid.Column="2"
  102. AllowInputSpecialValues="Any"
  103. AllowSpin="True"
  104. ClipValueToMinMax="True"
  105. CultureInfo="zh-cn"
  106. FormatString="P0"
  107. Increment="0.01"
  108. IsReadOnly="False"
  109. Maximum="1"
  110. Minimum="0"
  111. MouseWheelActiveOnFocus="True"
  112. ParsingNumberStyle="Any"
  113. ShowButtonSpinner="True"
  114. Value="{Binding GridOpacity,
  115. Mode=TwoWay}" />
  116. <!--
  117. <TextBlock Grid.Row="4"
  118. Grid.Column="0"
  119. Text="图表头显示" />
  120. <ComboBox Grid.Row="4"
  121. Grid.Column="2"
  122. ItemsSource="{Binding Visibilities}"
  123. SelectedItem="{Binding ShowHeader,
  124. Mode=TwoWay}" />
  125. -->
  126. <TextBlock Grid.Row="5"
  127. Grid.Column="0"
  128. Text="画图工具显示" />
  129. <ComboBox Grid.Row="5"
  130. Grid.Column="2"
  131. ItemsSource="{Binding Visibilities}"
  132. SelectedItem="{Binding ShowDrawingTool,
  133. Mode=TwoWay}" />
  134. <TextBlock Grid.Row="6"
  135. Grid.Column="0"
  136. Text="画图工具位置" />
  137. <ComboBox Grid.Row="6"
  138. Grid.Column="2"
  139. ItemsSource="{Binding DrawingToolPositions}"
  140. SelectedItem="{Binding DrawingToolPosition,
  141. Mode=TwoWay}" />
  142. <TextBlock Grid.Row="7"
  143. Grid.Column="0"
  144. Text="当前画图工具" />
  145. <ComboBox Grid.Row="7"
  146. Grid.Column="2"
  147. ItemsSource="{Binding DrawingToolTypes}"
  148. SelectedItem="{Binding DrawingToolType,
  149. Mode=TwoWay}" />
  150. <TextBlock Grid.Row="8"
  151. Grid.Column="0"
  152. Text="最大显示数据"
  153. ToolTip="滑块能拖动到的最大数据条数" />
  154. <xctk:IntegerUpDown Grid.Row="8"
  155. Grid.Column="2"
  156. AllowSpin="True"
  157. ClipValueToMinMax="True"
  158. Increment="1"
  159. IsReadOnly="False"
  160. Maximum="10000"
  161. Minimum="0"
  162. MouseWheelActiveOnFocus="True"
  163. ParsingNumberStyle="Any"
  164. ShowButtonSpinner="True"
  165. Value="{Binding MaxRecordCount,
  166. Mode=TwoWay}" />
  167. <TextBlock Grid.Row="9"
  168. Grid.Column="0"
  169. Text="最小显示数据"
  170. ToolTip="滑块能拖动到的最小数据条数" />
  171. <xctk:IntegerUpDown Grid.Row="9"
  172. Grid.Column="2"
  173. AllowSpin="True"
  174. ClipValueToMinMax="True"
  175. FormatString="N0"
  176. Increment="1"
  177. IsReadOnly="False"
  178. Maximum="10000"
  179. Minimum="0"
  180. MouseWheelActiveOnFocus="True"
  181. ParsingNumberStyle="Any"
  182. ShowButtonSpinner="True"
  183. ToolTip="滑块能拖动到的最小数据条数"
  184. Value="{Binding MinRecordCount,
  185. Mode=TwoWay}" />
  186. <TextBlock Grid.Row="10"
  187. Grid.Column="0"
  188. Text="默认数据"
  189. ToolTip="加载数据时默认数据条数" />
  190. <xctk:IntegerUpDown Grid.Row="10"
  191. Grid.Column="2"
  192. AllowSpin="True"
  193. ClipValueToMinMax="True"
  194. FormatString="N0"
  195. Increment="1"
  196. IsReadOnly="False"
  197. Maximum="10000"
  198. Minimum="0"
  199. MouseWheelActiveOnFocus="True"
  200. ParsingNumberStyle="Any"
  201. ShowButtonSpinner="True"
  202. Value="{Binding RecordCount,
  203. Mode=TwoWay}" />
  204. <!--
  205. <TextBlock Grid.Row="11"
  206. Grid.Column="0"
  207. Text="主图类型" />
  208. <ComboBox Grid.Row="11"
  209. Grid.Column="2"
  210. ItemsSource="{Binding LinePlotTypes}"
  211. SelectedItem="{Binding LinePlotType,
  212. Mode=TwoWay}" />
  213. -->
  214. <!--
  215. <TextBlock Grid.Row="12"
  216. Grid.Column="0"
  217. Text="添加指标图"
  218. ToolTip="目前只有Price,Volume" />
  219. <ComboBox Grid.Row="12"
  220. Grid.Column="2"
  221. ItemsSource="{Binding IndicatorTypes}"
  222. SelectedValue="{Binding IndicatorType,
  223. Mode=TwoWay}">
  224. <i:Interaction.Triggers>
  225. <i:EventTrigger EventName="SelectionChanged">
  226. <i:InvokeCommandAction Command="{Binding AddIndicatorCommand}" CommandParameter="{Binding ElementName=NewChart}" />
  227. </i:EventTrigger>
  228. </i:Interaction.Triggers>
  229. </ComboBox>
  230. -->
  231. <TextBlock Grid.Row="13"
  232. Grid.Column="0"
  233. Text="数据周期" />
  234. <ComboBox Grid.Row="13"
  235. Grid.Column="2"
  236. ItemsSource="{Binding CycleTypes}"
  237. SelectedValue="{Binding CycleType,
  238. Mode=TwoWay}" />
  239. <TextBlock Grid.Row="14"
  240. Grid.Column="0"
  241. Text="加速滚动快捷键" />
  242. <ComboBox Grid.Row="14"
  243. Grid.Column="2"
  244. ItemsSource="{Binding ModifierKeys}"
  245. SelectedValue="{Binding AcceleratedWheelModifierKeys,
  246. Mode=TwoWay}">
  247. <i:Interaction.Triggers>
  248. <i:EventTrigger EventName="SelectionChanged">
  249. <i:InvokeCommandAction Command="{Binding CycleTypeChangedCommand}" />
  250. </i:EventTrigger>
  251. </i:Interaction.Triggers>
  252. </ComboBox>
  253. <TextBlock Grid.Row="15"
  254. Grid.Column="0"
  255. Text="加速滚动倍数" />
  256. <xctk:IntegerUpDown Grid.Row="15"
  257. Grid.Column="2"
  258. AllowSpin="True"
  259. ClipValueToMinMax="True"
  260. FormatString="N0"
  261. Increment="1"
  262. IsReadOnly="False"
  263. Maximum="1000"
  264. Minimum="1"
  265. MouseWheelActiveOnFocus="True"
  266. ParsingNumberStyle="Any"
  267. ShowButtonSpinner="True"
  268. Value="{Binding AcceleratedWheelFactor,
  269. Mode=TwoWay}" />
  270. <TextBlock Grid.Row="16"
  271. Grid.Column="0"
  272. Text="商品代码" />
  273. <ComboBox x:Name="GoodsComboBox"
  274. Grid.Row="16"
  275. Grid.Column="2"
  276. DisplayMemberPath="Symbol"
  277. ItemsSource="{Binding GoodsInfos}"
  278. SelectedItem="{Binding GoodsInfo,
  279. Mode=TwoWay}"
  280. SelectedValuePath="Symbol" />
  281. <GroupBox Grid.Row="17"
  282. Grid.Column="0"
  283. Header="商品叠加:">
  284. <ListBox x:Name="ComparisonGoodsListBox"
  285. DisplayMemberPath="Symbol"
  286. ItemsSource="{Binding ComparisonGoodsList}"
  287. SelectionMode="Single">
  288. <i:Interaction.Triggers>
  289. <i:EventTrigger EventName="SelectionChanged">
  290. <i:InvokeCommandAction Command="{Binding ComparisonGoodsCommand}">
  291. <i:InvokeCommandAction.CommandParameter>
  292. <MultiBinding Converter="{StaticResource comparisonGoodsCommandConverter}">
  293. <Binding ElementName="NewChart" />
  294. <Binding ElementName="ComparisonGoodsListBox" />
  295. </MultiBinding>
  296. </i:InvokeCommandAction.CommandParameter>
  297. </i:InvokeCommandAction>
  298. </i:EventTrigger>
  299. </i:Interaction.Triggers>
  300. </ListBox>
  301. </GroupBox>
  302. <Button Grid.Row="17"
  303. Grid.Column="2"
  304. Command="{Binding CancelComparisonGoodsCommand}"
  305. CommandParameter="{Binding ElementName=NewChart}"
  306. Content="取消叠加" />
  307. <TextBlock Grid.Row="18"
  308. Grid.Column="0"
  309. Text="叠加蜡烛图是否填充" />
  310. <ComboBox x:Name="FillComparisonCandleComboBox"
  311. Grid.Row="18"
  312. Grid.Column="2"
  313. DisplayMemberPath="Key"
  314. ItemsSource="{Binding BoolDictionary}"
  315. SelectedItem="{Binding FillComparisonCandle,
  316. Mode=TwoWay}"
  317. SelectedValuePath="Value" />
  318. <TextBlock Grid.Row="19"
  319. Grid.Column="0"
  320. Text="加载数据条数"
  321. ToolTip="最大加载数据条数" />
  322. <xctk:IntegerUpDown Grid.Row="19"
  323. Grid.Column="2"
  324. AllowSpin="True"
  325. ClipValueToMinMax="True"
  326. FormatString="N0"
  327. Increment="1"
  328. IsReadOnly="False"
  329. Maximum="10000"
  330. Minimum="0"
  331. MouseWheelActiveOnFocus="True"
  332. ParsingNumberStyle="Any"
  333. ShowButtonSpinner="True"
  334. ToolTip="最大加载数据条数"
  335. Value="{Binding MaxLoadRecordCount,
  336. Mode=TwoWay}" />
  337. <Button x:Name="btnOpen"
  338. Grid.Row="20"
  339. Click="BtnOpen_OnClick"
  340. Content="编辑公式" />
  341. <Button x:Name="btnadd"
  342. Grid.Row="20"
  343. Grid.Column="2"
  344. Command="{Binding AddIndicatorCommand}"
  345. CommandParameter="{Binding ElementName=NewChart}"
  346. Content="添加指标" />
  347. <Button Grid.Row="21"
  348. Grid.Column="0"
  349. Command="{Binding ExportToExcel}"
  350. CommandParameter="{Binding ElementName=NewChart}"
  351. Content="导出数据到Excel" />
  352. </Grid>
  353. </GroupBox>
  354. <mi:Chart x:Name="NewChart"
  355. Grid.Column="1"
  356. AcceleratedWheelFactor="{Binding AcceleratedWheelFactor}"
  357. AcceleratedWheelModifierKeys="{Binding AcceleratedWheelModifierKeys}"
  358. ChartBackground="{Binding ChartBackground}"
  359. ChartFontSize="{Binding ChartFontSize}"
  360. ChartLanguage="{Binding ChartLanguage}"
  361. CurrentGoods="{Binding GoodsInfo}"
  362. CurrentTik="{Binding TikBarDataPoint}"
  363. CycleItems="{Binding CycleItems,
  364. Mode=TwoWay}"
  365. CycleType="{Binding CycleType,
  366. Mode=TwoWay}"
  367. DrawingToolIsEnabled="True"
  368. DrawingToolPosition="{Binding DrawingToolPosition}"
  369. DrawingToolType="{Binding DrawingToolType}"
  370. FillComparisonCandle="{Binding FillComparisonCandle.Value}"
  371. GridOpacity="{Binding GridOpacity}"
  372. LeftRightKeyToAcceleration="20"
  373. LinePlotType="{Binding LinePlotType}"
  374. MaxLoadRecordCount="{Binding MaxLoadRecordCount}"
  375. MaxRecordCount="{Binding MaxRecordCount}"
  376. MinRecordCount="{Binding MinRecordCount}"
  377. RecordCount="{Binding RecordCount}"
  378. RightBuffer="25"
  379. ShowDrawingTool="Visible" />
  380. </Grid>
  381. </Window>