Remove the space over stack panel
Hi
I am set the columns and rows ..First row i assing the stack panel with subelements that i set as Grod.row(0);
and another rows another stack panle with subelements are there that i set as a Gid.Row(1), it's working fine
if i clikc the some button i need to collapsed first stackpanle and second stackpanlemove to first position.
pls help put me
Thanks
Ram
Answers
Hi william,
I repro my application . i fixed it. throught
public void Refrencestackremove()
{
ww.StackPanelTopBodyPanleCaptions.Height = 0;
GridLength gl = new GridLength(0.0);
ww.TopBodyPanel.RowDefinitions[0].Height = gl;
}
#endregion
actually i used the grids under the stack panels that is why i used above function. it's working fine now.
Thanks
Ram- Marked As Answer byRammohan Ammiti Tuesday, November 10, 2009 11:04 AM
All Replies
Perhaps you can change the first stackpanel.Visibility to Collapsed as example below:
Markup:
<Window x:Class="GridPanelTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Name="firstPanel">
<TextBlock Text="First cell"/>
</StackPanel>
<StackPanel Grid.Row="1">
<TextBlock Text="Second cell"/>
</StackPanel>
</Grid>
<Button Content="Test" Click="Button_Click"/>
</StackPanel>
</Window>
Code:
using System.Windows;namespace GridPanelTest
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}private void Button_Click(object sender, RoutedEventArgs e)
{
firstPanel.Visibility = Visibility.Collapsed;
}
}
}
William- Proposed As Answer byMoby Disk Monday, November 09, 2009 5:17 PM
Hi
Thanks for your reply.. i have an idea how to collapsed. but i need to remove the first stackpanle space.
Again Thanks
Ram
your test application it's working fine.. but same thing i applied in my project it's not working any way thanks i try to fix according your way.. if i have any doubts i will contact to u william
Again thanks
Ram- right now i used the different different stack panels means stakpanel1 and subelements and stackpanle2 with subelements another grid with button but that grid is not in stack panel at that time space is not collapsed ..now pls suggest me.. if i place main grid in stack panle i lost lot of things...
this way suggest me willam... - Hi Rammohan,
Could you post a simple repro (markup/code) because it helps me to understand the problem better by reading the code and trying it?
Thanks,
William - Hi William,
Here, i am sending the my test application pls chk it once.
If i click the first button or secon button of the image.... i need collapsed stack panle and moved to the top .
Thanks
Ram- Edited byRammohan Ammiti Tuesday, November 10, 2009 11:05 AM
- The repro you shared out is pretty big. There’re many stackpanels, and I don’t know which one you want to collapse. Is it possible for you to simplify the repro? And Could you be specific on which stackpanel (like including the panel name) you want it be collapsed? Thanks.
William
Hi william,
I repro my application . i fixed it. throught
public void Refrencestackremove()
{
ww.StackPanelTopBodyPanleCaptions.Height = 0;
GridLength gl = new GridLength(0.0);
ww.TopBodyPanel.RowDefinitions[0].Height = gl;
}
#endregion
actually i used the grids under the stack panels that is why i used above function. it's working fine now.
Thanks
Ram- Marked As Answer byRammohan Ammiti Tuesday, November 10, 2009 11:04 AM


