我试图在一份清单中显示这份nes名单。
例如,如果事件情况有反应,我需要重复每一次事件的名称×时间。 每份答复都有3个检查箱。
我试图做的是名单显示:
• 应急方案——和;
我不想使用树木,因此,清单单行。 任何想法?
最新资料:
我要说的是,我有2项活动和1项活动,有2项选择,活动2为3项选择。 每个方案都有3个检查箱。
我如何试图显示数据:
Event 1 Response A [X] [ ] [ ]
Event 1 Response B [ ] [X] [X]
Event 2 Response A [X] [X] [X]
Event 2 Response D [ ] [ ] [X]
Event 2 Response E [X] [X] [X]
反应 我需要重复活动名称。
public class EventItem: DataAttributeChecked
{
public EventItem(int primaryKey, string value) : base(primaryKey, value)
{
ResponseOptions = new List<ResponseOption>();
}
public List<ResponseOption> ResponseOptions { get; set; }
}
public class ResponseOption: DataAttribute
{
public ResponseOption(int primaryKey, string value, int eventId) : base(primaryKey, value)
{
_eventId = eventId;
LevelOfEfforts = new List<DataAttributeChecked>();
}
public List<DataAttributeChecked> LevelOfEfforts { get; set; }
private readonly int _eventId;
public int EventId
{
get { return _eventId; }
}
}
<ListBox.ItemTemplate>
<DataTemplate>
<Border Margin="3" CornerRadius="2" BorderBrush="CadetBlue" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" />
<TextBlock Text="{Binding Value}" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="{Binding ResponseOption.Value}" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding ResponseOptions.LevelOfEffort}"
Name="lstOption"
SelectionMode="Multiple" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding Path=IsChecked, Mode=TwoWay}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3,3,3,3">
<CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" />
<TextBlock Text="{Binding Value}" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>