终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

431 lines
36 KiB

  1. <UserControl
  2. x:Class="BeDesignerSCADA.Controls.MainCanvasPanel"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:local="clr-namespace:BeDesignerSCADA.Controls"
  8. xmlns:s="clr-namespace:BeDesignerSCADA.Converters"
  9. xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
  10. xmlns:avae="http://icsharpcode.net/sharpdevelop/avalonedit"
  11. xmlns:Compiler="clr-namespace:BPASmartClient.Compiler;assembly=BPASmartClient.Compiler"
  12. xmlns:ctl="clr-namespace:BeDesignerSCADA.Controls"
  13. xmlns:mypro="http://schemas.xceed.com/wpf/xaml/toolkit"
  14. mc:Ignorable="d"
  15. d:DesignHeight="900" d:DesignWidth="1400">
  16. <UserControl.Resources>
  17. <ResourceDictionary>
  18. <ResourceDictionary.MergedDictionaries>
  19. <ResourceDictionary Source="/BeDesignerSCADA;component/Themes/Styles.xaml" />
  20. <ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
  21. </ResourceDictionary.MergedDictionaries>
  22. </ResourceDictionary>
  23. </UserControl.Resources>
  24. <Grid x:Name="grid">
  25. <Grid.ColumnDefinitions>
  26. <ColumnDefinition Width="240"/>
  27. <ColumnDefinition/>
  28. <ColumnDefinition Width="350"/>
  29. </Grid.ColumnDefinitions>
  30. <!--左侧选择区域-->
  31. <Grid >
  32. <Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Background="Transparent" Margin="4">
  33. <ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove">
  34. </ListBox>
  35. </Border>
  36. </Grid>
  37. <!--中间控制区域-->
  38. <DockPanel Grid.Column="1">
  39. <!--按钮控制-->
  40. <DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0">
  41. <Button Margin="0" Width="24" Padding="0" Click="AglinLeftBtn_Click" ToolTip="左对齐">
  42. <icon:PackIconModern Kind="AlignLeft"/>
  43. </Button>
  44. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinRightBtn_Click" ToolTip="右对齐">
  45. <icon:PackIconModern Kind="AlignRight"/>
  46. </Button>
  47. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinCenterBtn_Click" ToolTip="中心对齐">
  48. <icon:PackIconModern Kind="AlignCenter"/>
  49. </Button>
  50. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinTopBtn_Click" ToolTip="上对齐">
  51. <icon:PackIconModern Kind="BorderTop"/>
  52. </Button>
  53. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinBottomBtn_Click" ToolTip="下对齐">
  54. <icon:PackIconModern Kind="BorderBottom"/>
  55. </Button>
  56. <Button Margin="16 0 0 0" Width="24" Padding="0" Click="HorizontalLayoutBtn_Click" ToolTip="水平分布">
  57. <icon:PackIconModern Kind="BorderHorizontal"/>
  58. </Button>
  59. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="VerticalLayoutBtn_Click" ToolTip="垂直分布">
  60. <icon:PackIconModern Kind="BorderVertical"/>
  61. </Button>
  62. <ToggleButton IsChecked="{Binding UseAutoAlignment, ElementName=cav, Mode=TwoWay}" ToolTip="使用对齐网格" Margin="4 0 0 0" Width="24" Padding="0">
  63. <icon:PackIconModern Kind="CellAlign"/>
  64. </ToggleButton>
  65. <Button Margin="16 0 0 0" Width="24" Padding="0" ToolTip="复制" Command="{Binding ElementName=cav, Path=CopySelectItemsCommand}">
  66. <icon:PackIconModern Kind="PageCopy"/>
  67. </Button>
  68. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="粘贴" Command="{Binding ElementName=cav, Path=PasteSelectItemsCommand}">
  69. <icon:PackIconModern Kind="ClipboardPaste"/>
  70. </Button>
  71. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="删除" Command="{Binding ElementName=cav, Path=DeleteSelectItemsCommand}">
  72. <icon:PackIconModern Kind="Delete"/>
  73. </Button>
  74. <Button x:Name="RunBtn" Margin="16 0 0 0" Padding="0" Click="RunBtn_Click" Command="{Binding RunUiCommand}">
  75. <Button.Style>
  76. <Style TargetType="Button">
  77. <Setter Property="Tag" Value="运行"/>
  78. <Setter Property="Content">
  79. <Setter.Value>
  80. <StackPanel Orientation="Horizontal" Margin="8 0">
  81. <icon:PackIconModern Kind="ControlPlay" VerticalAlignment="Center" Foreground="#28B60F" Width="8"/>
  82. <TextBlock Text="运行" Margin="4 0" VerticalAlignment="Center"/>
  83. </StackPanel>
  84. </Setter.Value>
  85. </Setter>
  86. <Style.Triggers>
  87. <DataTrigger Binding="{Binding IsRunning}" Value="True">
  88. <Setter Property="Tag" Value="停止"/>
  89. <Setter Property="Content">
  90. <Setter.Value>
  91. <StackPanel Orientation="Horizontal" Margin="8 0">
  92. <icon:PackIconModern Kind="ControlStop" VerticalAlignment="Center" Foreground="#B60F0F" Width="8"/>
  93. <TextBlock Text="停止" Margin="4 0" VerticalAlignment="Center"/>
  94. </StackPanel>
  95. </Setter.Value>
  96. </Setter>
  97. </DataTrigger>
  98. </Style.Triggers>
  99. </Style>
  100. </Button.Style>
  101. </Button>
  102. <Button x:Name="SaveBtn" Margin="16 0 0 0" Padding="0" Click="SaveBtn_Click">
  103. <StackPanel Orientation="Horizontal" Margin="8 0">
  104. <icon:PackIconModern Kind="Save" VerticalAlignment="Center" Width="12"/>
  105. <TextBlock Text="保存" Margin="4 0" VerticalAlignment="Center"/>
  106. </StackPanel>
  107. </Button>
  108. <Button x:Name="LoadBtn" Margin="4 0 0 0" Padding="0" Click="LoadBtn_Click">
  109. <StackPanel Orientation="Horizontal" Margin="8 0">
  110. <icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/>
  111. <TextBlock Text="加载" Margin="4 0" VerticalAlignment="Center"/>
  112. </StackPanel>
  113. </Button>
  114. <Button x:Name="LoadBtnValue" Margin="4 0 0 0" Padding="0" Click="LoadBtnValue_Click">
  115. <StackPanel Orientation="Horizontal" Margin="8 0">
  116. <icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/>
  117. <TextBlock Text="变量管理" Margin="4 0" VerticalAlignment="Center"/>
  118. </StackPanel>
  119. </Button>
  120. <!--<Button x:Name="MNBtn" Margin="4 0 0 0" Padding="0" Click="MNBtn_Click">
  121. <StackPanel Orientation="Horizontal" Margin="8 0">
  122. <icon:PackIconModern Kind="MessageSend" VerticalAlignment="Center" Width="14"/>
  123. <TextBlock Text="模拟消息" Margin="4 0" VerticalAlignment="Center"/>
  124. </StackPanel>
  125. </Button>-->
  126. <ToggleButton x:Name="showCode" Click="showCode_Click" DockPanel.Dock="Right" Margin="4 0 0 0" Padding="4 0">
  127. <icon:Material Kind="FileCode"/>
  128. </ToggleButton>
  129. <Slider DockPanel.Dock="Right" Width="100" Maximum="16" Minimum="1" Margin="4 0 0 0"
  130. HorizontalContentAlignment="Center" Value="{Binding ElementName=cav,Path=GridPxiel}" ></Slider>
  131. <TextBlock DockPanel.Dock="Right" Text="对齐:" VerticalAlignment="Center" Margin="16 0 0 0"/>
  132. </DockPanel>
  133. <!--中间画布-->
  134. <Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
  135. <Border.Background>
  136. <ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/>
  137. </Border.Background>
  138. <Grid>
  139. <Grid.ColumnDefinitions>
  140. <ColumnDefinition/>
  141. <ColumnDefinition Width="auto"/>
  142. </Grid.ColumnDefinitions>
  143. <Compiler:CanvasPanel x:Name="cav" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True">
  144. <Compiler:CanvasPanel.Background>
  145. <VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute">
  146. <VisualBrush.Visual>
  147. <Rectangle Width="20" Height="20" StrokeDashArray="4,2" StrokeThickness="0.5" Stroke="#CBCBCB">
  148. <Rectangle.Style>
  149. <Style TargetType="{x:Type Rectangle}">
  150. <Style.Triggers>
  151. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="True">
  152. <Setter Property="Visibility" Value="Visible"/>
  153. </DataTrigger>
  154. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="False">
  155. <Setter Property="Visibility" Value="Collapsed"/>
  156. </DataTrigger>
  157. </Style.Triggers>
  158. </Style>
  159. </Rectangle.Style>
  160. </Rectangle>
  161. </VisualBrush.Visual>
  162. </VisualBrush>
  163. </Compiler:CanvasPanel.Background>
  164. <Compiler:CanvasPanel.RenderTransform>
  165. <TransformGroup>
  166. <TranslateTransform x:Name="CanvasTranslate"/>
  167. </TransformGroup>
  168. </Compiler:CanvasPanel.RenderTransform>
  169. </Compiler:CanvasPanel>
  170. <ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding RunCanvasVisibility}" />
  171. <avae:TextEditor x:Name="codeEditor" ShowLineNumbers="True" Padding="4" WordWrap="True" IsReadOnly="True" SyntaxHighlighting="XML" BorderThickness="1 0 0 0" BorderBrush="{StaticResource ControlBorderBrush}" Grid.Column="1" Width="480" Visibility="{Binding ElementName=showCode, Path=IsChecked, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"/>
  172. </Grid>
  173. </Border>
  174. </DockPanel>
  175. <GridSplitter HorizontalAlignment="Right" Grid.Column="1" VerticalAlignment="Stretch" Width="5" Background="Transparent"/>
  176. <!--右侧属性栏-->
  177. <Grid Grid.Column="2">
  178. <TabControl SelectedIndex="0">
  179. <TabItem Header="属性设置">
  180. <mypro:PropertyGrid Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True"
  181. FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False"
  182. AutoGenerateProperties="False"
  183. CategoryGroupHeaderTemplate="{DynamicResource Category}" SelectedObject="{Binding SelectedItem,ElementName=cav,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" >
  184. <mypro:PropertyGrid.PropertyDefinitions>
  185. <mypro:PropertyDefinition Name="FontSize" ></mypro:PropertyDefinition>
  186. <mypro:PropertyDefinition DisplayName="名称" Category="基本属性" DisplayOrder="0" Name="Name" Description="设置控件的标识,可以在Js脚本中通过标识操作控件。"/>
  187. <mypro:PropertyDefinition DisplayName="内容" Category="基本属性" DisplayOrder="1" Name="Content"/>
  188. <mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="1" Name="Header" Description="Header"/>
  189. <mypro:PropertyDefinition DisplayName="文本" Category="基本属性" DisplayOrder="1" Name="Text" Description="Text"/>
  190. <mypro:PropertyDefinition DisplayName="值" Category="基本属性" DisplayOrder="2" Name="NumberValue" Description="NumberValue"/>
  191. <mypro:PropertyDefinition DisplayName="数值" Category="基本属性" DisplayOrder="2" Name="CurValue" Description="CurValue"/>
  192. <mypro:PropertyDefinition DisplayName="状态值" Category="基本属性" DisplayOrder="2" Name="StatusValue" Description="StatusValue"/>
  193. <mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="2" Name="IsChecked" Description="IsChecked"/>
  194. <mypro:PropertyDefinition DisplayName="数值" Category="基本属性" DisplayOrder="2" Name="Value" Description="Value"/>
  195. <mypro:PropertyDefinition DisplayName="物料重量(g)" Category="基本属性" DisplayOrder="2" Name="KgValue" Description="克数"/>
  196. <mypro:PropertyDefinition DisplayName="物料描述" Category="基本属性" DisplayOrder="2" Name="WLText" Description="物料描述"/>
  197. <mypro:PropertyDefinition DisplayName="物料标题" Category="基本属性" DisplayOrder="2" Name="WLTitle" Description="物料标题"/>
  198. <mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="2" Name="Title" Description="标题"/>
  199. <mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/>
  200. <mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/>
  201. <mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="Maximum" Description="Maximum"/>
  202. <mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="Minimum" Description="Minimum"/>
  203. <mypro:PropertyDefinition DisplayName="间隔" Category="基本属性" DisplayOrder="3" Name="Interval"/>
  204. <mypro:PropertyDefinition DisplayName="宽度" Category="基本属性" DisplayOrder="3" Name="Width"/>
  205. <mypro:PropertyDefinition DisplayName="高度" Category="基本属性" DisplayOrder="3" Name="Height"/>
  206. <mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="3" Name="BindingIsChecked"/>
  207. <mypro:PropertyDefinition DisplayName="路径" Category="基本属性" DisplayOrder="3" Name="Source" />
  208. <mypro:PropertyDefinition DisplayName="FontSize" Category="基本属性" DisplayOrder="4" Name="FontSize"/>
  209. <mypro:PropertyDefinition DisplayName="字体" Category="基本属性" DisplayOrder="4" Name="FontFamily"/>
  210. <mypro:PropertyDefinition DisplayName="字体样式" Category="基本属性" DisplayOrder="4" Name="FontWeight"/>
  211. <mypro:PropertyDefinition DisplayName="斜体" Category="基本属性" DisplayOrder="4" Name="FontStyle"/>
  212. <mypro:PropertyDefinition DisplayName="下划线" Category="基本属性" DisplayOrder="4" Name="TextDecorations"/>
  213. <mypro:PropertyDefinition DisplayName="文字环绕样式" Category="基本属性" DisplayOrder="4" Name="TextWrapping"/>
  214. <mypro:PropertyDefinition DisplayName="是否使能" Category="基本属性" DisplayOrder="5" Name="IsEnabled"/>
  215. <mypro:PropertyDefinition DisplayName="是否显示" Category="基本属性" DisplayOrder="5" Name="Visibility"/>
  216. <mypro:PropertyDefinition DisplayName="回车换行" Category="基本属性" DisplayOrder="5" Name="AcceptsReturn"/>
  217. <mypro:PropertyDefinition DisplayName="鼠标样式" Category="基本属性" DisplayOrder="5" Name="Cursor"/>
  218. <mypro:PropertyDefinition DisplayName="键盘触发顺序" Category="基本属性" DisplayOrder="5" Name="TabIndex"/>
  219. <mypro:PropertyDefinition DisplayName="控件透明度" Category="基本属性" DisplayOrder="5" Name="Opacity"/>
  220. <mypro:PropertyDefinition DisplayName="垂直滚动条" Category="基本属性" DisplayOrder="6" Name="VerticalScrollBarVisibility"/>
  221. <mypro:PropertyDefinition DisplayName="水平滚动条" Category="基本属性" DisplayOrder="6" Name="HorizontalScrollBarVisibility"/>
  222. <mypro:PropertyDefinition DisplayName="是否ESC触发" Category="基本属性" DisplayOrder="7" Name="IsCancel"/>
  223. <mypro:PropertyDefinition DisplayName="是否Enter触发" Category="基本属性" DisplayOrder="7" Name="IsDefault"/>
  224. <mypro:PropertyDefinition DisplayName="垂直对齐" Category="基本属性" DisplayOrder="8" Name="VerticalContentAlignment"/>
  225. <mypro:PropertyDefinition DisplayName="水平对齐" Category="基本属性" DisplayOrder="8" Name="HorizontalContentAlignment"/>
  226. <mypro:PropertyDefinition DisplayName="所属分组" Category="基本属性" DisplayOrder="9" Name="GroupName"/>
  227. <mypro:PropertyDefinition DisplayName="文本提示" Category="基本属性" DisplayOrder="9" Name="ToolTip"/>
  228. <mypro:PropertyDefinition DisplayName="左边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Left)"/>
  229. <mypro:PropertyDefinition DisplayName="上边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Top)"/>
  230. <mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/>
  231. <mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/>
  232. <mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/>
  233. <mypro:PropertyDefinition DisplayName="接口参数" Category="数据绑定模块" DisplayOrder="2" Name="InterfaceParameters"/>
  234. <mypro:PropertyDefinition DisplayName="连接信息" Category="数据绑定模块" DisplayOrder="3" Name="DataSouceInformation"/>
  235. <mypro:PropertyDefinition DisplayName="设备解析变量" Category="数据绑定模块" DisplayOrder="4" Name="DeviceValuleName"/>
  236. <mypro:PropertyDefinition DisplayName="模拟运行" Category="数据绑定模块" DisplayOrder="4" Name="IsRun"/>
  237. <mypro:PropertyDefinition DisplayName="数据源" Category="数据绑定模块" DisplayOrder="5" Name="FDataSouce"/>
  238. <mypro:PropertyDefinition DisplayName="代码过滤脚本" Category="数据绑定模块" DisplayOrder="6" Name="Code"/>
  239. <mypro:PropertyDefinition DisplayName="数据结果" Category="数据绑定模块" DisplayOrder="7" Name="GenerateData"/>
  240. <mypro:PropertyDefinition DisplayName="定时间隔" Category="数据绑定模块" DisplayOrder="8" Name="TimeCount"/>
  241. <mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="ItemsString" />
  242. <mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="TabItems" />
  243. <mypro:PropertyDefinition DisplayName="子控件模板" Category="集合设置" Name="ChildTemplateXml" />
  244. <mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/>
  245. <mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/>
  246. <mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/>
  247. <mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/>
  248. <mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/>
  249. <mypro:PropertyDefinition DisplayName="边框" Category="基本属性" DisplayOrder="5" Name="WaveStroke"/>
  250. <mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="Fill"/>
  251. <mypro:PropertyDefinition DisplayName="边框" Category="基本属性" DisplayOrder="5" Name="Stroke"/>
  252. <mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="StrokeThickness"/>
  253. <mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="BorderThickness"/>
  254. <mypro:PropertyDefinition DisplayName="点击事件" Category="事件绑定" DisplayOrder="0" Name="ClickExec" />
  255. <mypro:PropertyDefinition DisplayName="值改变事件" Category="事件绑定" DisplayOrder="1" Name="ValueChangedExecute" />
  256. <mypro:PropertyDefinition DisplayName="定时触发" Category="事件绑定" DisplayOrder="2" Name="TikcExecute" />
  257. <mypro:PropertyDefinition DisplayName="勾选事件" Category="事件绑定" DisplayOrder="3" Name="CheckedExec" />
  258. <mypro:PropertyDefinition DisplayName="取消勾选事件" Category="事件绑定" DisplayOrder="4" Name="UnCheckedExec" />
  259. <mypro:PropertyDefinition DisplayName="接收消息集" Category="事件绑定" DisplayOrder="5" Name="EventReceiveNameList" />
  260. <mypro:PropertyDefinition DisplayName="出料单击事件" Category="事件绑定" DisplayOrder="6" Name="出料单击事件" />
  261. <mypro:PropertyDefinition DisplayName="停止出料单击事件" Category="事件绑定" DisplayOrder="7" Name="停止出料单击事件" />
  262. </mypro:PropertyGrid.PropertyDefinitions>
  263. <mypro:PropertyGrid.EditorDefinitions>
  264. <mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke">
  265. <mypro:EditorTemplateDefinition.EditingTemplate>
  266. <DataTemplate>
  267. <mypro:ColorPicker SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" />
  268. </DataTemplate>
  269. </mypro:EditorTemplateDefinition.EditingTemplate>
  270. </mypro:EditorTemplateDefinition>
  271. <mypro:EditorTemplateDefinition TargetProperties="Source">
  272. <mypro:EditorTemplateDefinition.EditingTemplate>
  273. <DataTemplate>
  274. <Grid>
  275. <Grid.ColumnDefinitions>
  276. <ColumnDefinition Width="*"/>
  277. <ColumnDefinition Width="35"/>
  278. </Grid.ColumnDefinitions>
  279. <ToggleButton Grid.Column="1" Height="30" Content="..." Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="LJToggleButton_Click"></ToggleButton>
  280. <TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
  281. </Grid>
  282. </DataTemplate>
  283. </mypro:EditorTemplateDefinition.EditingTemplate>
  284. </mypro:EditorTemplateDefinition>
  285. <!--子控件模板编辑-->
  286. <mypro:EditorTemplateDefinition TargetProperties="ChildTemplateXml">
  287. <mypro:EditorTemplateDefinition.EditingTemplate>
  288. <DataTemplate>
  289. <Grid>
  290. <ToggleButton Grid.Column="1" Height="30" Content=" 设置控件模板 " Margin="5,0,0,0" Click="ChildToggleButton_Click"></ToggleButton>
  291. <TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Visibility="Collapsed"/>
  292. </Grid>
  293. </DataTemplate>
  294. </mypro:EditorTemplateDefinition.EditingTemplate>
  295. </mypro:EditorTemplateDefinition>
  296. <!--代码绑定模块-->
  297. <mypro:EditorTemplateDefinition TargetProperties="ClickExec,ValueChangedExecute,TikcExecute,CheckedExec,UnCheckedExec" >
  298. <mypro:EditorTemplateDefinition.EditingTemplate>
  299. <DataTemplate>
  300. <Grid>
  301. <Grid.ColumnDefinitions>
  302. <ColumnDefinition Width="*"/>
  303. <ColumnDefinition Width="40"/>
  304. </Grid.ColumnDefinitions>
  305. <ToggleButton Grid.Column="1" Height="20" Content="编辑" Width="30" Margin="5,0,5,0" HorizontalAlignment="Left" Click="ToggleButton_Click"></ToggleButton>
  306. <TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
  307. </Grid>
  308. </DataTemplate>
  309. </mypro:EditorTemplateDefinition.EditingTemplate>
  310. </mypro:EditorTemplateDefinition>
  311. <mypro:EditorTemplateDefinition TargetProperties="Code" >
  312. <mypro:EditorTemplateDefinition.EditingTemplate>
  313. <DataTemplate>
  314. <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
  315. <TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" TextWrapping="Wrap"></TextBox>
  316. </ScrollViewer>
  317. </DataTemplate>
  318. </mypro:EditorTemplateDefinition.EditingTemplate>
  319. </mypro:EditorTemplateDefinition>
  320. <mypro:EditorTemplateDefinition TargetProperties="IsRun" >
  321. <mypro:EditorTemplateDefinition.EditingTemplate>
  322. <DataTemplate>
  323. <CheckBox IsChecked="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">定时业务</CheckBox>
  324. </DataTemplate>
  325. </mypro:EditorTemplateDefinition.EditingTemplate>
  326. </mypro:EditorTemplateDefinition>
  327. <mypro:EditorTemplateDefinition TargetProperties="DeviceName" >
  328. <mypro:EditorTemplateDefinition.EditingTemplate>
  329. <DataTemplate>
  330. <ComboBox Grid.Column="1" Height="25" Width="{Binding Width, ElementName=com}" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  331. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.DevNameList}"
  332. ></ComboBox>
  333. </DataTemplate>
  334. </mypro:EditorTemplateDefinition.EditingTemplate>
  335. </mypro:EditorTemplateDefinition>
  336. <mypro:EditorTemplateDefinition TargetProperties="Text,Content,Title,Value,BindingIsChecked,Header,KgValue,WLText,WLTitle,DataSouceInformation" >
  337. <mypro:EditorTemplateDefinition.EditingTemplate>
  338. <DataTemplate>
  339. <!--此处可自由发挥-->
  340. <Grid>
  341. <Grid.RowDefinitions>
  342. <RowDefinition/>
  343. <RowDefinition/>
  344. </Grid.RowDefinitions>
  345. <Grid Margin="0,5,0,5">
  346. <Grid.ColumnDefinitions>
  347. <ColumnDefinition Width="40" />
  348. <ColumnDefinition Width="*" x:Name="key"/>
  349. <ColumnDefinition Width="*" x:Name="Text"/>
  350. </Grid.ColumnDefinitions>
  351. <TextBlock>绑定:</TextBlock>
  352. <ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
  353. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.DevNameList}">
  354. </ComboBox>
  355. <ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
  356. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.DevValueList}"/>
  357. </Grid>
  358. <Grid Grid.Row="2">
  359. <Grid.ColumnDefinitions>
  360. <ColumnDefinition Width="*"/>
  361. <ColumnDefinition Width="40"/>
  362. </Grid.ColumnDefinitions>
  363. <TextBox Grid.Row="2" x:Name="wenben" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
  364. <StackPanel Grid.Column="1">
  365. <ToggleButton Grid.Column="1" Height="20" Content="绑定" Width="30" Margin="5,0,5,0" HorizontalAlignment="Left" Click="BingToggleButton_Click"></ToggleButton>
  366. <ToggleButton Height="20" Content="解绑" Width="30" Margin="5,2,5,0" HorizontalAlignment="Right" Click="ClearBingToggleButton_Click"></ToggleButton>
  367. </StackPanel>
  368. </Grid>
  369. </Grid>
  370. </DataTemplate>
  371. </mypro:EditorTemplateDefinition.EditingTemplate>
  372. </mypro:EditorTemplateDefinition>
  373. </mypro:PropertyGrid.EditorDefinitions>
  374. </mypro:PropertyGrid>
  375. </TabItem>
  376. <!--<TabItem Header="所有属性">
  377. <mypro:PropertyGrid x:Name="dsdsdsd"
  378. Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True"
  379. FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False"
  380. CategoryGroupHeaderTemplate="{DynamicResource Category}" SelectedObject="{Binding SelectedItem,ElementName=cav,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
  381. </TabItem>-->
  382. </TabControl>
  383. </Grid>
  384. </Grid>
  385. </UserControl>