views:

106

answers:

1

I have a page (telerik:RadPage) containing few grids and some nested controls and I was wondering how I can:

have a particular cell in one of the grid make always visible even during scrolling. I am not even sure if it is possible, but the one cell I want visible is the first one I am displaying.

Any help is appreciated and all suggestions are welcome.

Thanks!

A: 

Hi VoodooChild,

I have no experience working with Rad controls, but if you want to have something that's not scrollable - move it out of the ScrollViewer. This is general principle.

I give here three possible approaches, with increasing complexity, but I hope they help you at least get going.

1. Duplicate first element and show it above ScrollViewer:

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  <Grid>  
    <ListBox>
      <TextBlock Text="First element"/>
      <TextBlock Text="Second element"/>
      <TextBlock Text="Third element"/>
      <TextBlock Text="Forth element"/>
      <TextBlock Text="Fifth element"/>
    </ListBox>    
    <!-- Overlay -->
    <Border Background="White" VerticalAlignment="Top">
      <TextBlock Text="Overlay text. Should be a duplicate of the First Element"
                 Margin="3, 0"/>
    </Border>
  </Grid>
</Page>

This method has a loot of drawbacks. Starting from duplication itself and ending with focus/keyboard management.

2. All except first elements goes into the list. First element is a separate control:

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  <Grid>  
    <Grid.RowDefinitions>
     <RowDefinition Height="Auto"/>
     <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!-- First Element -->
    <TextBlock Text="First element"
               Grid.Row="0"
               Margin="4, 0"/>

    <!-- List Element -->
    <ListBox Grid.Row="1" BorderThickness="0">
      <TextBlock Text="Second element"/>
      <TextBlock Text="Third element"/>
      <TextBlock Text="Forth element"/>
      <TextBlock Text="Fifth element"/>
    </ListBox>    
  </Grid>
</Page>

3. Write custom control.

I don't mention Adorners here, because they seems like advanced version of approach #1. Although combined with the last approach they may result in quite good solution...

Anvaka
I moved the one element I don't want in a scrollviewer out of the scrollview, but the way my app is structured it didn't work as expected. we have a common telerik:RadFrame where we display all of our pages, and in this parent/container radframe we added a scrollviewer. So by default now all our pages have scrolling.In this particular case, I wonder if I can disable the scrollviewer and write one just for the one page.It might be possible, but unsure at this point.Thanks for your reply!
VoodooChild