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

Problem with GridDataControl width

Thread ID:

Created:

Updated:

Platform:

Replies:

98363 Feb 23,2011 09:15 AM UTC Mar 4,2011 09:07 AM UTC WPF 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2011 09:15 AM UTC

Hi there,

I have a big problem with the width of my grid. Every time I open it, it becomes a width about 1300px.

This is how I have defined the window with the grid in my .xaml:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Entscheidungstabelle" Height="396" Width="525" MinWidth="525" SizeToContent="WidthAndHeight" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" WindowStartupLocation="CenterOwner" HorizontalAlignment="Left" VerticalAlignment="Top">









The columns will be created in Codebehind in this way:

private void CreateTable()
{
int columns = DataItem.AnzahlColumns;
AddDataColumn(" ");
AddDataColumn("Anweisung");
for (int i = 1; i <= columns; i++)
{
AddDataColumn("R" + i);
}
AddDataColumn("SONST");
gdcEntscheidungstabelle.ItemsSource = _dataItems;
}

private void AddDataColumn(string uniqueName, bool insert = false)
{
GridDataVisibleColumn column = new GridDataVisibleColumn();
if (uniqueName != " ")
{
column.MappingName = uniqueName;
}
else
{
column.MappingName = "col1";
column.IsReadOnly = true;
}
column.HeaderText = uniqueName;//p;
column.AllowSort = false;
column.AllowGroup = false;

if (insert)
{
int index = gdcEntscheidungstabelle.VisibleColumns.Count - 1;
this.gdcEntscheidungstabelle.VisibleColumns.Insert(index, column);
}
else
{
gdcEntscheidungstabelle.VisibleColumns.Add(column);
}
}

I will attach my DataSource (ViewModel) to this post because it's too much. It has more than 200 column-properties.

I hope someone can help me.
Thanks
Andreas



ViewModel_57fe6810.zip

Habeeb Rahman [Syncfusion]
Replied On March 4, 2011 09:07 AM UTC

Hi Andreas,

Thanks for using Syncfusion Products.

You can achieve your requirement by setting the code as follows:

Code snippet [XAML]:



Code snippet [C#]:

this.gridData.ColumnSizer = GridControlLengthUnitType.Star;

Please let us know if this helps.

Regards,
Habeeb




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

;