-1

Define two column in wpf,each column has a GridControl (left GridControl should take whole area if right GridControl is collapsed or take half area if right GridControl is visible)

I try to set ColumnDefinition (Width=auto or Width=*) but do not achieve the expectation

1 Answers1

0

Try this:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
        <Border BorderBrush="HotPink" BorderThickness="1">
            <TextBlock Text="Left Grid"/>
        </Border>
    </Grid>
    <Grid Grid.Column="1" Visibility="Collapsed">
        <Border BorderBrush="HotPink" BorderThickness="1">
            <TextBlock Text="Right Grid"/>
        </Border>
    </Grid>
</Grid>
Andrew KeepCoding
  • 7,040
  • 2
  • 14
  • 21
  • Thank you for your answer,this way i have tried but do not achieve the expectation,My Problem has been solved by this link. https://stackoverflow.com/questions/53316277/how-to-collapse-a-star-sized-grid-column-in-wpf – By_All_Means_Rome Nov 23 '22 at 10:10