Search code examples
c#.netxaml

Xaml make element through two columns


I have simple grid

<Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
    ....

On the last row I have TextBlock but I need that text block to take two columns. Problem is that if it take just first column it stretch other three elements to right which I dont want.

Is this achievable? If yes how?


Solution

  • I think you are looking for a columnspann

    https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.grid.columnspan?view=windowsdesktop-6.0