Hidding an Entire Grid (Button.Click)

I'v been trying to figure out how to hide an Entire Grid with a Button Click...In C# a non-WPF Application you could do this with just,   form.Show();

I have tried using the GridName but  the  .Show() dosnt appear so i know thiers another way of doing it, I just cant figure it out..

Any help with this is Appreciated...Thxs in Advance

Here is the Xaml Code for the Button:

<Button HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-7,2,0,0" Width="36" Height="33.5533333333333" Background="{x:Null}" x:Name="RSSButton" Foreground="{x:Null}" BorderBrush="{x:Null}" Click="RSSButtonClick">

private void RSSButtonClick(object sender, System.Windows.RoutedEventArgs e)

{

if(RSSFeed.IsVisible == false)
     this.Show();


     else if(RSSFeed.IsVisible == true)
     this.Show() = false // I know this isnt correct but i'm Lost...lol

}

Version:Ocas RC1,Sept Build of EID,.NET 3.0 RC1,Windows SDK RC1

OS: XP Pro with Media Center 2005



Answer this question

Hidding an Entire Grid (Button.Click)

  • teqmem

    Yeah i'v seen the Visisiblity.Collapsed etc in the Properties panel,the Show and Hide is more of what i need to work for the Button.Click Event...To Show the Widget & Hide the Widget for each button in the ToolBar,the Close() method going to give that a shot also...

    Thxs for the info..I'll probably be posting again on this topic...lol


  • NBryant

    Are you trying to hide the entire form or just a container within it

  • Pradeep Gupta

    Ok here is the Current Code i'm using but theirs a issue ...The Grid is named RSSFeed for starts....If you run that Code with the button the program during "Test project will Run" But the RSSFeed Dosnt show up at all,even when i Press the Button....If i remove the Code the RSSFeed will be their during the "Test project",Now if you run the Code as is...What happens is the RSSFeed Dosnt Appear at all,but it Minimized the Project to where i have to go into the Task Manager to end the "Test Project" Process...

    I tried   .Close()   well that actually shuts down the "Test Project" just like if you closed out an Application by pressing the  X button on any app...So I'm not sure what the problem is overall,If someone can run threw the code that would be Appreciated...Thxs

     

     As of right now just hiding the RSS Widget,Not to Minimize the Entire project to the TaskBar during "Test Project Etc "

    private void RSSButtonClick(object sender, System.Windows.RoutedEventArgs e)
      {
         if(RSSFeed.IsVisible)
            {
              this.Show();
            }
            else
            {
               this.Hide();
            }
        
         }


  • mrotoloni

    Take a look at the Visibility property inherited from UIElement. You can set it to the following values:

    • Visibility.Collapsed (hidden but does not occupy any layout space)
    • Visibility.Hidden (hidden but does occupy layout space)
    • Visibilty.Visible

    For Window you can also use the Show() and Hide() methods, which are very similar to setting the Visibilty property (refer to the SDK documentation for details). If you want to actually close the Window you should call its Close() method.



  • Rattlerr

    Please direct any non-designer related questions to the appropriate forums, such as Windows Presentation Foundation ("Avalon").



  • Hidding an Entire Grid (Button.Click)