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. Image for the cookie policy date
close icon

GridTreeControl: Column Width

Hey,

I have a problem. I cant set the width of a column in a GridTreeControl. In c#.

I can set the columnwidth in the xaml, but only for the first time. If I reset the grid, and try to resize the columns nothing happens.
So i debugged the part of SourceCode. I can see, that the Values are parse right and the new width must be my set Value. But it isnt.

I turned off the behavouir as well... and tryed a few things. But after 5 h now, i dont know what i can try next.

Here is a code snipe:

LiquiditaetsAusgabe.Reset();

//liquiditätsplan.GetParentTable() Just gives a smal DataView //over some columns.
TreeGrid.ItemsSource =
liquiditätsplan.GetParentTable(HauptSet, "");

this.TreeGrid.DefaultColumnWidth = 150;
this.TreeGrid.EnableHotRowMarker = true;
this.TreeGrid.EnableNodeSelection = true;
this.TreeGrid.PercentSizingBehavior = GridPercentColumnSizingBehavior.None; this.LiquiditaetsAusgabe.AllowAutoSizingNodeColumn = false;

// this.TreeGrid.InternalGrid.Columns[0].Width = 300.0;
// this.TreeGrid.Model.ColumnWidth[0] = 300.0;
this.TreeGrid.Columns[0].Width = 300.0;

Even the DefaultColumnWidth dosnt work.




6 Replies

RG Rajasekar G Syncfusion Team March 7, 2012 10:54 AM UTC

Hi Roddis,

Width and ColumnWidth properties are working fine when we set in Code behind[C#] also. We have prepared the sample and code snippet for this. Please revert us with the modified sample if you are still facing the issue. Please refer attached image and sample program.

Code snippet:
//Setting default Width to column
this.treeGrid.DefaultColumnWidth = 50;

treeGrid.ModelLoaded += (s, e) =>
{
treeGrid.ColumnHeaderStyle.HorizontalAlignment = HorizontalAlignment.Center;
treeGrid.InternalGrid.ExpandGlyphType = GridTreeExpandGlyph.PlusMinus;

//Setting Width to FirstName column
treeGrid.Columns[1].Width = 150;
};


Please let us know if you need more details.

Thanks&Regards,
Raja sekar.G





102810attachement_ead5d4dc.zip


SR Sean Roddis March 7, 2012 12:22 PM UTC

Hey,

its kind of curious.
If I use try to use:
GTC.Model.ColumnWidths[3] = 0;
in my Projekt, I get a "EntryPointNotFoundException".

But if I open ure Sample (http://www.syncfusion.com/downloads/Support/DirectTrac/88696/TreeGridBinding652655451.zip)
it works... even if I add new Columns and hide them.



RG Rajasekar G Syncfusion Team March 7, 2012 01:15 PM UTC

Hi Roddis,

Width and ColumnWidth properties are working fine when we set in Code behind[C#] also. We have prepared the sample and code snippet for this. Please revert us with the modified sample if you are still facing the issue. Please refer attached image and sample program.

Code snippet:
//Setting default Width to column
this.treeGrid.DefaultColumnWidth = 50;

treeGrid.ModelLoaded += (s, e) =>
{
treeGrid.ColumnHeaderStyle.HorizontalAlignment = HorizontalAlignment.Center;
treeGrid.InternalGrid.ExpandGlyphType = GridTreeExpandGlyph.PlusMinus;

//Setting Width to FirstName column
treeGrid.Columns[1].Width = 150;
};


Please let us know if you need more details.

Thanks&Regards,
Raja sekar.G






102810attachement_a0e6cccb.zip


SR Sean Roddis March 7, 2012 01:34 PM UTC

Hey again,

I found a way to handle my problem.

GTC.Column[n].width = 0;
GTC.Populate();

works.
So I think, my window or grid dont update right.



RG Rajasekar G Syncfusion Team March 8, 2012 12:23 PM UTC

Hi Sean Roddis,

Thank you for your update.

Please let me know if you have any queries.

Thanks,
Raja sekar.G




RG Rajasekar G Syncfusion Team March 8, 2012 12:24 PM UTC

Hi Sean Roddis,

Thank you for your update.

Please let me know if you have any queries.

Thanks,
Raja sekar.G



Loader.
Live Chat Icon For mobile
Up arrow icon