Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

xaml c# treeview reorder ItemsControl

$
0
0

I have this: <TreeView Name="treeView_m" > <ItemsControl ItemsSource="{Binding Interaction.DispositionCode.ListOfDispositionCodeValue}" Width="Auto" Height="Auto" MinHeight="30" Margin="2" TextSearch.TextPath="DisplayName" DockPanel.Dock="Top" AutomationProperties.Name="List of Disposition Code Value" Name="listOfDispositionCodeValueItemsControl"> <ItemsControl.ItemContainerStyle> <Style> <Setter Property="AutomationProperties.Name" Value="{Binding DisplayName}"/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel x:Name="radiobuttons" Orientation="Horizontal" Margin="5,1,1,1"><RadioButton IsChecked="{Binding IsSelected}" GroupName="DispositionCodeGroupName" Click="radioButton_Checked" ToolTip="{Binding Description}"> <TextBlock Margin="5,0,0,0" Foreground="{DynamicResource SilverBorderColorBrush}" Text="{Binding DisplayName}" /> </RadioButton> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </TreeView>

It adds all the radio buttons on a runtime. Then I use this code to see what is in this ItemsControl:foreach (Genesyslab.Desktop.Modules.Core.Model.BusinessAttributes.IDispositionCodeValue item in listOfDispositionCodeValueItemsControl.Items) { if (item.DisplayName.Contains("MAIN_1") || item.DisplayName.Contains("MAIN_2")) { //here should go some code

What I need to do is if item.DisplayName.Contains("MAIN_1") then this Radio button should be as main branch in a treeview, next item (if does not contain MAIN) goes as its child, under it with possibility to expand, unless it contains "MAIN_2", then this goes as main brach again. I am new in all this. I really appreciate any help you can provide.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>