Alessandro Del Sole's Blog

{ A programming space about Microsoft® .NET® }
posts - 1909, comments - 2047, trackbacks - 352

My Links

News

Your host

This is me! Questo spazio è dedicato a Microsoft® .NET®, di cui sono molto appassionato :-)

Cookie e Privacy

Disabilita cookie ShinyStat

Microsoft MVP

My MVP Profile

Microsoft Certified Professional

Microsoft Specialist

Xamarin Certified Mobile Developer

Il mio libro su VB 2015!

Pre-ordina il mio libro su VB 2015 Pre-ordina il mio libro "Visual Basic 2015 Unleashed". Clicca sulla copertina per informazioni!

Il mio libro su WPF 4.5.1!

Clicca sulla copertina per informazioni! E' uscito il mio libro "Programmare con WPF 4.5.1". Clicca sulla copertina per informazioni!

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.
If you're not an Italian user, please visit my English blog

Le vostre visite

I'm a VB!

Guarda la mia intervista a Seattle

Follow me on Twitter!

Altri spazi

GitHub
I miei progetti open-source su GitHub

Article Categories

Archives

Post Categories

Image Galleries

Privacy Policy

WPF: the Expander control

In Windows Presentation Foundation we can use a control called Expander, which is a sort of controls contanier and that can be expanded and closed just with a mouse click. Let's see a graphical sample.

In Visual Studio 2005, type the following XAML:

    <Grid>
      <Expander Margin="10,10,10,10" Background="LightBlue">
        <Expander.Header>
          Expander control sample
        </Expander.Header>

        <ListBox Margin="20,10,0,0" Background="LightGreen">
          <ListBoxItem Content="First item"  />
          <ListBoxItem Content="Second item" />
        </ListBox>
      </Expander>
    </Grid>

The element Expander contains another element called Expander.Header, which contains the text (or another control deriving from FrameworkElement) to be shown. As a nested element, we can specify a control to show when the Expander gets opened. In this case we have drawn a ListBox with just two items. This is the result you obtain when launching the application:

This is what you obtain by expanding the control:

Alessandro

Print | posted on domenica 14 ottobre 2007 16:24 |

Powered by:
Powered By Subtext Powered By ASP.NET