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
265
Show Tree without "key groups"
posted

Hello,

I build a example with my problem. My Business Object look like a Explorer with Folder and Files. I would like show them without the grouping Nodes from Datagrid.

If i select only the Folder to display, it looks fine, but with differnt types the grid create Groups, I don't need them here.

Any idea or workarounds?

Thx for your help, with greetings from Germany.
Thomas

// RESULT TREE - should look like this

//
//    MainFolder
//        Folder0
//            SubFolder0
//                SubSubFile0
//                SubSubFile1
//            SubFolder1
//                SubSubFile0
//                SubSubFile1
//            SubFile0
//            SubFile1
//            SubFile2
//        Folder1
//            SubFolder0
//                SubSubFile0
//                SubSubFile1
//            SubFolder1
//                SubSubFile0
//                SubSubFile1
//            SubFile0
//            SubFile1
//            SubFile2
//        Folder3
//            SubFolder0
//                SubSubFile0
//                SubSubFile1
//            SubFolder1
//                SubSubFile0
//                SubSubFile1
//            SubFile0
//            SubFile1
//            SubFile2
//        File0                                
//        File1                                
//        File2                                
//        File3                                
//        File4                               

C#-Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace infragistic
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {

            InitializeComponent();
           
            ObservableCollection<Folder> MainCollection;
            MainCollection = new ObservableCollection<Folder>();
            
            Folder MainFolder = new Folder();
            MainFolder.FolderName = "MainFolder";
            MainCollection.Add(MainFolder);
            File fi;
            Folder fo;
            Folder fo2;
            for (int i = 0; i < 5; i++) {
                fi = new File();
                fi.FileName = "File " + i.ToString();
                MainFolder.Files.Add(fi);
            }
            for (int i = 0; i < 3; i++) {
                fo = new Folder();
                fo.FolderName = "SubFolder " + i.ToString();
                for (int j = 0; j < 3; j++) {
                    fi = new File();
                    fi.FileName = "SubFile " + j.ToString();
                    fo.Files.Add(fi);
                }
                for (int k = 0; k < 2; k++) {
                    fo2 = new Folder();
                    fo2.FolderName = "SubFolder " + k.ToString();
                    for (int l = 0; l < 2; l++) {
                        fi = new File();
                        fi.FileName = "SubSubFile " + l.ToString();
                        fo2.Files.Add(fi);
                    }
                    fo.Folders.Add(fo2);
                }

                MainFolder.Folders.Add(fo);
            }
            xamDataTree1.ItemsSource = MainCollection;


        }
    }

    public class Folder
    {
        ObservableCollection<Folder> _Folders = new ObservableCollection<Folder>();
        ObservableCollection<File> _Files = new ObservableCollection<File>();
        public string FolderName { get; set; }


           public ObservableCollection<Folder> Folders
           {
              get
              {
                 if (this._Folders == null)
                    this._Folders = new ObservableCollection<Folder>();

                 return this._Folders;
              }
           }

           public ObservableCollection<File> Files
           {
              get
              {
                 if (this._Files == null)
                    this._Files = new ObservableCollection<File>();

                 return this._Files;
              }
           }


    }
    public class File
    {
        public string FileName { get; set; }
    }
}

XAML Example:

<Window x:Class="infragistic.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" xmlns:ig="http://schemas.infragistics.com/xaml">
    <Grid>
        <ig:XamDataTree HorizontalAlignment="Left" Margin="38,28,0,0" Name="xamDataTree1" VerticalAlignment="Top" >
            <ig:XamDataTree.GlobalNodeLayouts>
                <ig:NodeLayout Key="FolderLayout" TargetTypeName="Folder"
                      DisplayMemberPath="FolderName">
                </ig:NodeLayout>
                <ig:NodeLayout Key="FileLayout" TargetTypeName="File"
                      DisplayMemberPath="FileName">
                </ig:NodeLayout>
            </ig:XamDataTree.GlobalNodeLayouts>
        </ig:XamDataTree>
    </Grid>
</Window>

  • 138253
    Offline posted

    Hello Thomas,

     

    After some research Show child collections flat has been determine as a new Product Idea.  I have sent your Product Idea directly to our product management team.  Our product team chooses new Product Ideas for development based on popular feedback from our customer base.  Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.

     

    We value your input, and our philosophy is to enhance our toolset based on customer feedback.  If your idea is chosen for development, you will be notified at that time.  Your reference number for this Product Idea is PI13070014

     

    If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email.  Please include the reference number of your Product Idea in the subject and body of your email message.  You can reach Developer Support management through the following email address:  dsmanager@infragistics.com