Peekay
Peekay

Reputation: 451

Auto Sizing between grid columns

I have two controls and a GridSplitter .

 <Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />           
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
   <UserControlOne Grid.Colum="0" Visibility="{Binding MyProperty1}"/>
   <GridSplitter Visibility="{Binding MyProperty1}" m:Splitterbehaviour.Apply= true/>
   <UserControlTwo Grid.Colum="1" />
 </Grid>

I am trying to show/hide the UserControlOne with the MyProperty1 which is working fine but when it is hidden i want the UsercontrolTwo to take whole page space. I could easily achieve this by using a stack or dock panel. But if i use the stackpanel or dockpanel my GridSplitter wont work.(I have a behaviour set to GridSplitter which will identify the first column and it will help to resize the first and second column)

Upvotes: 0

Views: 45

Answers (1)

paparazzo
paparazzo

Reputation: 45106

I don't see how that splitter is working

 <Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>           
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <UserControlOne Grid.Colum="0" Visibility="{Binding MyProperty1}"/>
    <UserControlTwo Grid.Colum="1"/>
 </Grid>

Upvotes: 0

Related Questions