Home Forums WPF controls Xceed DataGrid for WPF Problem with column resizing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23894 |

    I have a grid that I’m adding columns to at run-time. I don’t specify Width, MinWidth or MaxWidth on these columns. When I examine the values of the properties, they are (for example):

    Width – 160
    MinWidth – 120
    MaxWidth – Infinity

    Yet, I can’t resize the columns. The cursor doesn’t even change when I hover over the resizing thumb.

    What am I missing? The difference between this particular grid and other grids in the application is that this is the only one that has columns added at run-time.

    Thanks in advance!

    Imported from legacy forums. Posted by Lori (had 495 views)

    User (Old forums)
    Member
    Post count: 23064

    Do you have your ColumnManagerRow in there?

    Here’s some code I pulled out of a test project, there are better examples in the Xceed docs as my code was modified after the cut/paste into this thread… but you get the idea if you haven’t already thought of this:
    <code>
    <xcdg:DataGridControl x:Name=”m_testGrid” Height=”400″ ” Grid.Row=”5″>
    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:GroupByControl AllowSort=”False” AllowGroupingModification=”False”/>
    </DataTemplate>
    <DataTemplate>
    <xcdg:ColumnManagerRow AllowSort=”True” AllowColumnReorder=”False”/>
    </DataTemplate>
    <DataTemplate>
    <xcdg:InsertionRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>

    <xcdg:TableView.FixedFooters>
    <!– We make sure that the FixedFooters collection is empty before adding
    our custom content. –>
    <xcdg:ClearHeadersFooters/>

    <!– Anything can be added to the various DataGridControl collections (FixedHeaders,
    Headers, Items, Footers and FixedFooters). But it has to be wrapped in a DataTemplate.–>
    <DataTemplate>
    <TextBox Text=”I’m a footer”/>
    </DataTemplate>
    </xcdg:TableView.FixedFooters>

    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </code>

    Imported from legacy forums. Posted by Richard (had 315 views)

    User (Old forums)
    Member
    Post count: 23064

    You can also initialize the ColumnManager row in code. Here’s one way to do it (this was cut and pasted from a working project):

    <code>

    public class MyColumnManagerRow : ColumnManagerRow
    {
    public MyColumnManagerRow()
    : base()
    {
    AllowSort = true;
    }
    }

    // elsewhere some grid initialization code …

    TableView tableView = new TableView();

    tableView.FixedHeaders.Clear();
    DataTemplate template = new DataTemplate();
    template.VisualTree = new FrameworkElementFactory(typeof(MyColumnManagerRow));
    tableView.FixedHeaders.Add(template);

    template = new DataTemplate();
    template.VisualTree = new FrameworkElementFactory(typeof(InsertionRow));
    tableView.FixedHeaders.Add(template);

    </code>

    Imported from legacy forums. Posted by Richard (had 3267 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.