Click here to Skip to main content
15,878,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
On the right side of my Form I have a grid with two on columns,the right column is "45" in width and the left one named "LeftColumn" is set as "Auto" for width. I would like to use checked and unchecked events of a toggle button named "Togglebtn" to show and hide that "LeftColumn"


What I have tried:

XML
<pre><!--// Navigation Panel //-->
 
 <Grid x:Name="nav_pnl"
                  HorizontalAlignment="Right"
                  Width="Auto"
                  Background="#00171F" 
				  Margin="0,45,0,0">

            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="LefttColumn" Width="Auto" />
                <ColumnDefinition Width="45" />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="300" />
                <RowDefinition Height="45" />
                <RowDefinition Height="45" />
                <RowDefinition Height="45" />
                <RowDefinition Height="45" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!--First navigation item-->

            <Button x:Name="Home"
                        Height="45"
                        BorderBrush="Transparent"
                        Grid.Column="1" Grid.Row="1">

                <Button.Background>

                    <ImageBrush ImageSource="images/Home_2.png"
                                Stretch="Uniform"/>

                </Button.Background>

            </Button>

            <Label x:Name ="HomeText"
                       Grid.Column="0" 
					   Grid.Row="1"
					   Width ="185"
					   Height="45"
					   Style="{StaticResource font_nav_style}" 
                       Content="الصفحة الرئيسية"/>
					   
			<!--There are 3 other items-->

        </Grid>
Posted
Updated 20-Mar-21 7:16am
v2
Comments
[no name] 20-Mar-21 11:10am    
If you want to hide a column, set the Width to zero. You can add a name to the ColumnDefinition for access in the Toggle checked / unchecked events.
Member 15109172 20-Mar-21 12:54pm    
I did, but I couldn't access the ComunDefinition in the Toggle checked/unchecked events.
BillWoodruff 20-Mar-21 11:51am    
show the code you are using now, show the xaml for the grid.
BillWoodruff 20-Mar-21 23:06pm    
show the code/and or xaml for the button and its event handlers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900