locked
expand collapse in grid RRS feed

  • Question

  • i have simple structure

    as follows

     

    <grid>

    <label>

    <combo>

    <label>

    <combo>

    <label>

    <textbox>

    </grid>

     

    i hv a condition when to show second label and combobox depending on whats selected in first

    i achieved it but if its hidden space is stil there of those two controls

    how to implement expand collapse similar to way we do with hiding and showing div control in asp.net

    Sunday, December 19, 2010 1:25 PM

Answers

  • Hello mandar j,

    You can change structure to the following:

    <StackPanel Orientation="Vertical">

        <StackPanel Orientation="Horizontal">

          <Label>Label1</Label>

          <ComboBox/>

        </StackPanel>

        <StackPanel Orientation="Horizontal" x:Name="hiddenPanel">

          <Label>Label2</Label>

          <ComboBox/>

        </StackPanel>

        <StackPanel Orientation="Horizontal">

          <Label>Label3</Label>

          <TextBox/

        </StackPanel>

      </StackPanel>

    When you have it, you can change visibility of one panel: this.hiddenPanel.Visibility = Visibility.Collapsed;


    Best Regards, Sergey
    • Marked as answer by Yves.Z Friday, December 24, 2010 9:29 AM
    Sunday, December 19, 2010 2:33 PM

All replies

  • Hello mandar j,

    You can change structure to the following:

    <StackPanel Orientation="Vertical">

        <StackPanel Orientation="Horizontal">

          <Label>Label1</Label>

          <ComboBox/>

        </StackPanel>

        <StackPanel Orientation="Horizontal" x:Name="hiddenPanel">

          <Label>Label2</Label>

          <ComboBox/>

        </StackPanel>

        <StackPanel Orientation="Horizontal">

          <Label>Label3</Label>

          <TextBox/

        </StackPanel>

      </StackPanel>

    When you have it, you can change visibility of one panel: this.hiddenPanel.Visibility = Visibility.Collapsed;


    Best Regards, Sergey
    • Marked as answer by Yves.Z Friday, December 24, 2010 9:29 AM
    Sunday, December 19, 2010 2:33 PM
  •  

    Hi mandar j,

    We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.

     

    Best regards,

    Yves


    Yves Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 24, 2010 9:29 AM