Home Forums WPF controls Xceed DataGrid for WPF Column Width

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

    Hello, I have a data grid with 3 columns.

    I’d like the first 2 columns to be 50, an the 3rd column to have all the space left over.

    How can I achieve this?

    Thanks

    Imported from legacy forums. Posted by Murthy (had 612 views)

    User (Old forums)
    Member
    Post count: 23064

    In a column definitions for columns, you can do:
    For 1st and 2nd columns:
    <xcdg:Column FieldName=”YourName” Title=”YourTitle” Width =”50″ />
    For the last column:
    <xcdg:Column FieldName=”YourName” Title=”YourTitle” MinWidth =”{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollContentPresenter}}, Path=ActualWidth}” />
    Good Luck! Lena

    Imported from legacy forums. Posted by Lena (had 216 views)

    User (Old forums)
    Member
    Post count: 23064

    I have tried your solution but it does not work. My DataGridControl is placed in a TabItem of a TabControl.

    Have you any suggestions ? Thank.

    Imported from legacy forums. Posted by Bernard (had 450 views)

    User (Old forums)
    Member
    Post count: 23064

    Do you know the width of entire grid? You can calculate it then.
    Also, you can create DataRow template
    <Style TargetType=”{x:Type xcdg:DataRow}”>
    <Setter Property=”MinWidth” Value=”{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollContentPresenter}}, Path=ActualWidth}”/>
    </Style>
    which will extend the width of each row in Grid.
    The problem is that the Column Width property on DataGridControl can be only double – there are no Auto or * options. Try to find work around.
    Good luck! Lena

    Imported from legacy forums. Posted by Lena (had 267 views)

    User (Old forums)
    Member
    Post count: 23064

    Look, I found this on forum:
    http://forums.xceed.com/forums/ShowPost.aspx?PostID=9325
    Maybe, it’ll help you?

    Imported from legacy forums. Posted by Lena (had 4511 views)

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