终端一体化运控平台
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.
 
 
 

384 lines
31 KiB

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