开发者

Always display top of Silverlight page

I am developing a Silverlight navigation application which has 3 parts:

  • one upper part where the company logo is shown along with a menu (fixed height)
  • the middle part holds the navigation frame (variable height)
  • the bottom part has some copyright information and a sound on/off button(fixed height)

The middle part stretches as much as needed to display t开发者_开发问答he whole content but then it also sets the view to the middle of the page. I would like to always have the top of the page (the menu) displayed.

How can I achieve this?


Yes what you are describing is essentially a "Silverlight Navigation Application". If you create a project of this type the template will give you most of what you described at the outset.

Have created this new project I recommend the following changes. Modify the main page to look like this:-

<Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}">
         <!-- Cut for brevity -->
    </Grid>

    <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" Grid.Row="1">
         <!-- Cut for brevity -->
    </Border>

    <Border x:Name="FooterBorder" Style="{StaticResource FooterBorderStyle}" Grid.Row="2">
        <Grid>
            <TextBlock Text="Copyright info here" />
        </Grid>
    </Border>
</Grid>

Modify the "NavigationGridStyle" and "ContentBorderStyle" and also add the "FooterBorderStyle" in the /Assets/styles.xaml like this:-

  <Style x:Key="ContentBorderStyle" TargetType="Border">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,0.045" StartPoint="0.5,0">
          <GradientStop Color="#6FCCCCCC"/>
          <GradientStop Color="#00CCCCCC" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
    <Setter Property="BorderThickness" Value="0,3,0,0"/>
  </Style>

  <Style x:Key="NavigationGridStyle" TargetType="Grid">
    <Setter Property="Background" Value="{StaticResource NavigationBackgroundColorBrush}"/>
  </Style>

  <Style x:Key="FooterBorderStyle" TargetType="Border">
      <!-- Whatever styling if any you want here -->
  </Style>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜