如何在 c# 中从 radTreeListView SelectedItems 集合中检索所有选中项目?
Retrieve All Checked Items下面的示例根本不起作用。
foreach ( object checkedItem in radTreeView.CheckedItems )
{
// Get the container(RadTreeViewItem) of the checked item
RadTreeViewItem container = radTreeView.ContainerFromItemRecursive( checkedItem );
// Add your logic for handling the checked item scenario here
}
RadTreeListView 的 XML 是
<telerik:RadTreeListView x:Name="radTreeListView" ItemsSource="{Binding Items}"
AutoGenerateColumns="False" Grid.RowSpan="2" SelectionChanged="radTreeListView_SelectionChanged" SelectionMode="Extended" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" SelectionChanging="radTreeListView_SelectionChanging" BeginningEdit="radTreeListView_BeginningEdit">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewSelectColumn/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>