Problem with column widths

Grids for WPF Forum

Posted 15 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Version: 9.1.0500
Platform: .NET 3.5
Environment: Windows Vista (64-bit)
I have an extensively restyled property grid and have noticed that sometimes some rows will have a different width for the name column than all the others. It only seems to happen on the first layout pass - if the property grid is resized then the columns are resized so they are all the same width.

This can be reproduced with the default style in a wizard generated project - simply paste the following into Window1.xaml:

<Window x:Class="WpfApplication1.Window1"
  <StackPanel Margin="5">
    <g:PropertyGrid SelectedObject="{Binding ElementName=button}" 
                    IsSummaryVisible="False" />
    <Button x:Name="button" 
            Content="Target Button" 
            Margin="0,10,0,0" />
Some of the affected rows include:
- KeyboardNavigation.ControlTabNavigation
- KeyboardNavigation.DirectionalNavigation
- Background
- CommandBindings

As soon as the window is resized all rows jump to the same width.

I have sent a screenshot of the problem to support.

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Phil,

This is a known issue with the native WPF Grid control, which the PropertyGrid uses internally. Specially, it uses a shared size scope, which doesn't work correctly when using * column sizes and you don't give a fixed width.

The only current work around is to set the Width on the Window and change SizeToContent to be Height only. The Window can be resized latter, as you've seen.

Actipro Software Support

The latest build of this product (v24.1.2) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.