Kurtevich
Kurtevich

Reputation: 345

DevExpress GridControl ColumnAutoWidth

The question is probably silly, but I spent half of the day looking for the answer with no luck.

I have a WPF view with DevExpress GridControl included (not developed by me). The problem is that when I click "Auto fit" option - it gets too wide with a horizontal scroll. The reason is long header titles, but it's Ok if they are wrapped into 2 lines.

After some searching, I thought that what I need is ColumnAutoWidth property. The problem (here goes the silly part) is that I can't find out how to set it! Because of this I can't check if it works at least! There are no examples in documentation, and code autocomplete doesn't show it's presence anywhere. I had some assumptions but they appeared to be wrong.

Can somebody please share XAML (or at least code-behind) example about how to access this property?

Upvotes: 2

Views: 8892

Answers (2)

Eldar
Eldar

Reputation: 872

Your link is documentaion for WinForms grid. For Wpf GridColumn http://documentation.devexpress.com/#WPF/DevExpressXpfGridGridColumnMembersTopicAll

As I understand you question - you want to fix column width. Try this

<dxg:GridColumn Header="MyAwesomeColumn"
    Width="40"
    FixedWidth="True"
    FieldName="MyFieldName" />

Upvotes: 2

Cedar
Cedar

Reputation: 509

you just have to remove width element from your columns, and to set the autowidth element of the tableview. the link you posted is related xtraGrid control and it is a windows form not a WPF one, you have to control the width from the TableView.AutoWidth property.

Try to read the following documentation

Upvotes: 3

Related Questions