Hello,
I have a data class like this:
public class UICameraTree : NotificationObject{ private string _stakeholderName; private ObservableCollection<UICamera> _cameraList = new ObservableCollection<UICamera>(); private ObservableCollection<UICameraTree> _cameraTree = new ObservableCollection<UICameraTree>();
public string StakeHolderName { get { return _stakeholderName; } set { _stakeholderName = value; base.RaisePropertyChanged(() => StakeHolderName); } } public ObservableCollection<UICamera> CameraList { get { return _cameraList; } } public ObservableCollection<UICameraTree> CameraTree { get { return _cameraTree; } }}
And XAML like:
<ig:XamDataTree x:Name="CameraDataTree" Grid.Row="1" Style="{StaticResource DASXamDataTree}" ItemsSource="{Binding UICameraTree.CameraTree}" IsDraggable="True"> <ig:XamDataTree.CheckBoxSettings> <ig:CheckBoxSettings CheckBoxVisibility="Hidden" /> </ig:XamDataTree.CheckBoxSettings> <ig:XamDataTree.GlobalNodeLayouts> <ig:NodeLayout Key="GroupLayout" TargetTypeName="UICameraTree" DisplayMemberPath="StakeHolderName"/> <ig:NodeLayout Key="ItemLayout" TargetTypeName="UICamera" DisplayMemberPath="CameraList\CameraName /> </ig:XamDataTree.GlobalNodeLayouts></ig:XamDataTree>
How can I get rid off "GroupLayout" and "ItemLayout" from the tree?
Thank you!
David
Hello David,
I reviewed your issue and I can suggest you set a style for the XamDataTreeNodeControl and in the style to modify the height of the nodes where the Content equals “ItemLsayout” or “GroupLayout”. Before hiding this nodes you can ensure that you have already expanded their hierarchies because after hiding them their expansionindicator will be hidden too. You may try the following code snippet to achieve this functionality:
<Style TargetType="{x:Type ig:XamDataTreeNodeControl}">
<EventSetter Event="Loaded" Handler="CameraDataTree_Loaded"/>
<Style.Triggers>
<Trigger Property="Content" Value="GroupLayout">
<Setter Property="Height" Value="0"/>
</Trigger>
<Trigger Property="Content" Value="ItemLayout">
<Setter Property="Height" Value="0" >
</Setter>
</Style.Triggers>
</Style>
private void CameraDataTree_Loaded(object sender, RoutedEventArgs e)
{
(sender as XamDataTreeNodeControl).Node.IsExpanded = true;
}
If you need any further assistance on this, please do not hesitate to ask.
Elena,
I've attached some sample code of what we're using...
Thanks,
I am just checking have you been able to resolve your issue? If you need any further assistance with it, I will be glad to help.
Hello Rajesh,
I believe that currently, there is no built in functionality that can terminate the extra space that occurs in the left of the nodes because. This place is reserved for the checkbox and the NodeLineTermiantorl as you can see from the default template of the XamDataTreeNodeControl. I believe that you can change this space based on the current node. For example you can set ValueConverter for the width of the second and third column of the grid named “main”, where they are placed. You can try the following snippet:
In the xaml:
<ColumnDefinition Width="{Binding Node, Converter={StaticResource conWidth}}" />
In the code behind:
public class MyConverterWidth : IValueConverter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
if ((value as XamDataTreeNode).Nodes.Count == 0)
return 0;
return 20;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();
Now it adds extra indent for child nodes, any further tweak to fix this?
Also, Isnt there inherent support for this kind of structure?
my requirement is a standard treeview requirement:- i have groups, groups can have subgroups or items. this can go upto 5levels
I investigate this issue and I add the NodeLineControl back to the XamDataTreeNodeControl’s template in order to achieve the desired look. Please find the attached sample where the nodes are ordered in the hierarchy.
I hope this suits your scenario better.
Hi Elena,
The child node does not appear indented when i checked your sample for David.
Child and parent node appears with same indent so its is very difficult to identify the child node.
Can you pls guide how to identation for the child after grouplayout/itemlayout ?
regards,
Rajesh