Adding elements to a panel in c#!

quick question, in a c# Windows Presentation Foundation How can i add some elements to a Panel so i can easily hide all the elements (Text, Labels...) by just hiding the panel it self? I have already tried to just put panels over the elements to hide them but i don't think that would be a neat solution because i would also hide all the other elements under it. I need this because i am trying to have different forms in the same place and on the base of what the user types the items should appear. I don't want it to open a new window.



Assuming all your elements are in the same container, just set the Visibility property of the container to "Collapsed". Ideally, this would be by binding to a bool and using the BoolToVisibility converter provided in WPF.

If they are NOT in the same container, you are a bit out of luck. You will need to set/bind each of the element's visibility properties separately, but using the same techniques as above.

If you place all of the elements you want on that panel you can tell that panel to be invisible or visible and all of the elements on that panel will hide or show accordingly. For ease of use when you are programming you can right click on the panel and choose send back or bring forward and this will help you navigate your form while programming.

Panel is a base class and has a Visibility property

Panel Properties

<StackPanel x:Name="pnl1" Grid.Row=0 Visibility="Collapsed">
    <TextBlock x:Name="tbTime" />
    <TextBlock x:Name="tbDate" />
<StackPanel x:Name="pnl2" Grid.Row=2 Visibility="Visible">
    <TextBlock x:Name="tbTime2" />
    <TextBlock x:Name="tbDate2" />

Need Your Help

Understanding user permissions and how to apply it

php zend-framework permissions user-permissions socialengine

I am developing a module for a site using Social Engine, which uses Zend Framework. I am new to both Zend Framework and Social Engine but have experience in OOP and MVC architecture so could get to...

Twilio Lookup API is not returning value in java


As part of our project we need to call Twilio to get E164 format of the Phone Number. In order to do that I followed the below steps to achieve. If the phone number is valid then the below step is