We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Initialize the Grid Tree Control

Thread ID:

Created:

Updated:

Platform:

Replies:

93292 Mar 9,2010 02:16 AM UTC Mar 11,2010 12:39 PM UTC WPF 3
loading
Tags: GridControl
J.T
Asked On March 9, 2010 02:16 AM UTC

I have a question about the Grid Tree Control

When initialize the Grid Tree Control. It seems I need to get three levels' data. It is too inefficient for our project.

I hope only get the data of highest level when initialize(it look like collapse all nodes)


please see the Attachment



Initialize Grid Tree Control _b6ff31f9.rar

Clay Burch [Syncfusion]
Replied On March 9, 2010 12:56 PM UTC

By default, the GridTreeControl loads one level in advance so it knows whether the displayed children need to have an expand glyph or not. There is a HideEmptyChilGlyph property that controls this behavior.

Also, by default, the GridTreeControl displays with the root nodes expanded. To avoid this behavior, you need to set a property on the gridTreeControl.InternalGrid. To set such properties requires that you handle the ModelLoaded event and set the properties in that event (since the InternalGrid has been created when this event is raised).

So, try code like this in that sample to see if it does what you want:


public Window1()
{
InitializeComponent();

//one time, initialize the data access some how...
employees = new EmployeesCollection();
employees.PopulateWithSampleData(500);

treeGrid.ModelLoaded += new EventHandler(treeGrid_ModelLoaded);
treeGrid.HideEmptyChildGlyphs = false; }



void treeGrid_ModelLoaded(object sender, EventArgs e)
{
treeGrid.InternalGrid.ExpandStateAtStartUp = GridTreeStartUpExpandState.NoNodesExpanded;
}

J.T
Replied On March 11, 2010 10:13 AM UTC

Thanks very much for the respond.

I have another question.

Does the GridTreeControl has the ResizingColumns event,because i hope to cancel the default resizing and auto-size it through the "ResizeColumnsToFit" method

Clay Burch [Syncfusion]
Replied On March 11, 2010 12:39 PM UTC

There are a couple of properties specific to the GridTreeControl that affect column widths. The AllowAutoSizingNodeColumn property controls whether the GridTreeControl automatically increases the size of the treenode columns as more levels are exposed. There is also a PercentSizingBehaviorProperty that controls how the GridTreeControl can be set so its columns automatically cover all of the grid's client area.

If you want to make it impossible for your user to size columns through the UI, then you can handle treeGrid.InternalGrid.ResizingColumns event. Below is some code showing how you might set these properties and subscribe to this event in the ModelLoaded event.


void treeGrid_ModelLoaded(object sender, EventArgs e)
{
treeGrid.InternalGrid.ExpandStateAtStartUp = GridTreeStartUpExpandState.NoNodesExpanded;

treeGrid.PercentSizingBehavior = GridPercentColumnSizingBehavior.None;
treeGrid.AllowAutoSizingNodeColumn = false;

treeGrid.InternalGrid.ResizingColumns += new GridResizingColumnsEventHandler(InternalGrid_ResizingColumns);
}

void InternalGrid_ResizingColumns(object sender, GridResizingColumnsEventArgs args)
{
args.AllowResize = false;
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;