Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Nesting in XamDataTree
posted

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

Parents
  • 17559
    posted

    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>

                    </Trigger>

                </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.

Reply Children