8,833
社区成员




<DataGrid x:Name="GroupSearchDataGrid" DockPanel.Dock="Left" GridLinesVisibility="All" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
BorderThickness="0" SelectionMode="Single" SelectionUnit="FullRow" AutoGenerateColumns="False" CanUserAddRows="False"
ItemsSource="{Binding DataSource,Mode=TwoWay}" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
Style="{StaticResource DefaultDataGrid}" >
<DataGrid.Columns>
<DataGridTextColumn Header="队列号" Width="*" Binding="{Binding StepNum}" IsReadOnly="True" FontSize="16"/>
<DataGridTextColumn Header="项目编号" Width="*" Binding="{Binding ItemNum}" IsReadOnly="True" FontSize="16"/>
<DataGridTemplateColumn Width="*" MinWidth="100" Header="项目">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding ItemIsChecked}"></CheckBox>
<TextBlock Text="项目" FontFamily="微软雅黑" FontSize="16"></TextBlock>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
public class ProgressStepModel
{
public int StepNum { get; set; }
public int ItemNum { get; set; }
public bool ItemIsChecked { get; set; }
public bool FuncIsChecked { get; set; }
public bool LogicIsChecked { get; set; }
public string Description { get; set; }
public bool SelectFuncVisibility { get; set; }
public bool SelectThresholdVisibility { get; set; }
public string ThresholdValue { get; set; }
public string Deviation { get; set; }
}
<UserControl x:Class="VisionPlugin.Views.TestUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<ListView ItemsSource="{Binding Tests}">
<ListView.View>
<GridView>
<GridViewColumn Header="测试1">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<CheckBox BorderBrush="Transparent" BorderThickness="0" IsChecked="{Binding IsChecked1, Mode=TwoWay}" IsEnabled="False" Width="70"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="测试2">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<CheckBox BorderBrush="Transparent" BorderThickness="0" IsChecked="{Binding IsChecked2, Mode=TwoWay}" IsEnabled="False" Width="70"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="测试3">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<CheckBox BorderBrush="Transparent" BorderThickness="0" IsChecked="{Binding IsChecked3, Mode=TwoWay}" IsEnabled="False" Width="70"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</UserControl>
public class TestUserControlViewModel : NotificationObject
{
private ObservableCollection<TestModel> tests;
public ObservableCollection<TestModel> Tests
{
get { return tests; }
set
{
tests = value;
this.RaisePropertyChanged("Tests");
}
}
public TestUserControlViewModel()
{
tests = new ObservableCollection<TestModel>() {
new TestModel(){
IsChecked1 =true,
IsChecked2=false,
IsChecked3 =false,
},
new TestModel(){
IsChecked1 =false,
IsChecked2=false,
IsChecked3 =false,
},
new TestModel(){
IsChecked1 =false,
IsChecked2=true,
IsChecked3 =true,
},
};
}
}
public class TestModel : NotificationObject
{
private bool isChecked1;
public bool IsChecked1
{
get { return isChecked1; }
set
{
isChecked1 = value;
this.RaisePropertyChanged("IsChecked1");
}
}
private bool isChecked2;
public bool IsChecked2
{
get { return isChecked2; }
set
{
isChecked2 = value;
this.RaisePropertyChanged("isChecked2");
}
}
private bool isChecked3;
public bool IsChecked3
{
get { return isChecked3; }
set
{
isChecked3 = value;
this.RaisePropertyChanged("IsChecked3");
}
}
}
<GridViewColumn Header="拍照">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<CheckBox BorderBrush="Transparent" BorderThickness="0" IsChecked="{Binding IsTakePicture, Mode=TwoWay}" IsEnabled="False" Width="70"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
private bool isTakePicture;
public bool IsTakePicture
{
get { return isTakePicture; }
set
{
isTakePicture = value;
this.RaisePropertyChanged("IsTakePicture");
}
}