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