SCItemEditor.xaml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <UserControl x:Class="MECF.Framework.UI.Core.Control.SCItemEditor"
  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:MECF.Framework.UI.Core.Control"
  7. xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
  8. xmlns:Selector="clr-namespace:MECF.Framework.UI.Core.Selector"
  9. mc:Ignorable="d"
  10. d:DesignHeight="450" d:DesignWidth="900">
  11. <Grid>
  12. <DataGrid AutoGenerateColumns="False" Margin="5" Background="White" ItemsSource="{Binding ScItemList, Mode=OneWay}" SelectionMode="Single" SelectionUnit="FullRow"
  13. FontFamily="Arial,SimSun" FontSize="13" BorderThickness="0.1" CanUserDeleteRows="False" CanUserAddRows="False" IsReadOnly="True" >
  14. <DataGrid.Resources>
  15. <DataTemplate x:Key="TextBoxTemplate">
  16. <TextBox Text="{Binding SetPoint, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12"/>
  17. </DataTemplate>
  18. <DataTemplate x:Key="ComboBoxTemplate">
  19. <ComboBox Text="{Binding SetPoint, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12">
  20. <ComboBoxItem>True</ComboBoxItem>
  21. <ComboBoxItem>False</ComboBoxItem>
  22. </ComboBox>
  23. </DataTemplate>
  24. </DataGrid.Resources>
  25. <DataGrid.Columns>
  26. <DataGridTextColumn Header="Index" Width="50" CanUserSort="True" IsReadOnly="True" Binding="{Binding Index,Mode=OneWay}">
  27. </DataGridTextColumn>
  28. <DataGridTextColumn Header="Name" Width="250" CanUserSort="True" IsReadOnly="True" Binding="{Binding PathName,Mode=OneWay}">
  29. </DataGridTextColumn>
  30. <DataGridTemplateColumn Header="Description" Width="200" >
  31. <DataGridTemplateColumn.CellTemplate>
  32. <DataTemplate>
  33. <TextBox Text="{Binding Description, Mode=OneWay }" TextWrapping="Wrap" FontSize="12"/>
  34. </DataTemplate>
  35. </DataGridTemplateColumn.CellTemplate>
  36. </DataGridTemplateColumn>
  37. <DataGridTextColumn Header="Type" Width="50" CanUserSort="True" IsReadOnly="True" Binding="{Binding Type,Mode=OneWay}">
  38. </DataGridTextColumn>
  39. <DataGridTextColumn Header="Min" Width="90" CanUserSort="True" IsReadOnly="True" Binding="{Binding Min,Mode=OneWay}">
  40. </DataGridTextColumn>
  41. <DataGridTextColumn Header="Max" Width="90" CanUserSort="True" IsReadOnly="True" Binding="{Binding Max,Mode=OneWay}">
  42. </DataGridTextColumn>
  43. <DataGridTextColumn Header="Value" Width="100" CanUserSort="True" IsReadOnly="True" Binding="{Binding Value,Mode=OneWay}">
  44. </DataGridTextColumn>
  45. <DataGridTemplateColumn Header="SetPoint" Width="90" CanUserSort="True" SortMemberPath="Type">
  46. <!--<DataGridTemplateColumn.CellTemplate>
  47. <DataTemplate>
  48. <TextBox Text="{Binding SetPoint, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12"/>
  49. </DataTemplate>
  50. </DataGridTemplateColumn.CellTemplate>-->
  51. <DataGridTemplateColumn.CellTemplateSelector>
  52. <Selector:ControlTemplateSelector TextBoxTemplate="{StaticResource TextBoxTemplate}" ComboBoxTemplate="{StaticResource ComboBoxTemplate}" />
  53. </DataGridTemplateColumn.CellTemplateSelector>
  54. </DataGridTemplateColumn>
  55. <DataGridTemplateColumn Header="Command" Width="90" CanUserSort="False" >
  56. <DataGridTemplateColumn.CellTemplate>
  57. <DataTemplate>
  58. <Button Content="Set" FontSize="12" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type DataGrid}},
  59. Path=DataContext.SetScCommand}" CommandParameter="{Binding PathName}"/>
  60. </DataTemplate>
  61. </DataGridTemplateColumn.CellTemplate>
  62. </DataGridTemplateColumn>
  63. </DataGrid.Columns>
  64. </DataGrid>
  65. </Grid>
  66. </UserControl>