tags:

views:

23

answers:

1

c# vs2010

hi all: how can I bring to focus on a window all controls hidden on expander.

expander is collapsed at the bottom of the window, when i click on it to expand it (i have to scroll down,'cause controls are not showing on the window), I would like to bring into focus the first control and be able to see the last control on the window without manually scrolling.

any ideas how to accomplish this task on Xaml or code behind.

thanks

A: 
<Window>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="*" />
      <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <ScrollViewer>
      <!-- lol stuff here -->
    </ScrollViewer>
    <Expander Grid.Row="1">
      <TextBlock>Wow! You don't have to scroll to see me!</TextBlock>
    </Expander>
  </Grid>
</Window>
Will
Will: can you explain me where this code performs my request.
ramnz
@ramnz Hmm, I missed the "focus" part; I was concentrating on being able to see everything in the expander--"be able to see the last control on the window without manually scrolling." If you place the expander in the ScrollViewer your expander may scroll out of view. This markup keeps all items on screen (assuming you have enough real estate). You can (ech, this is a cheap answer) subscribe to the Expanded event of the Expander and set focus on its first child. That's a quick and dirty method of doing it...
Will