How to change my code to show the Horizontal scroll bar at the bottom of the page(Grid)?

2 posts, 0 answers
  1. ABC
    ABC avatar
    15 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    here is my codes:
    <UserControl x:Class="SilverlightApplication1.MainPage12"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
       
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid>
                <telerik:RadTabControl  VerticalAlignment="Top" x:Name="RadContainer"
        DisplayMemberPath="Content" DropDownDisplayMode="Visible" ScrollMode="Viewport"
        Background="White" BorderThickness="0" >
                    <telerik:RadTabItem  Padding="4 1" DropDownContent="A" >
                        <telerik:RadTabItem.Header>
                            <TextBlock Text="A" Margin="19 2 19 0" FontSize="15"/>
                        </telerik:RadTabItem.Header>
                        <telerik:RadTabItem.Content>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" x:Name="stp" Orientation="Horizontal">
                                    <ComboBox x:Name="cbshow" Width="150">
                                        <ComboBoxItem IsSelected="True">1</ComboBoxItem>
                                        <ComboBoxItem>2</ComboBoxItem>
                                    </ComboBox>
                                    <Button Content="click" Click="Button_Click" Width="150" ></Button>
                                </StackPanel>
                                <telerik:RadGridView x:Name="rgv1" Grid.Row="1" AutoGenerateColumns="False" SelectionMode="Extended" SelectionUnit="FullRow"
                                 IsFilteringAllowed="False" CanUserFreezeColumns="False" ShowGroupPanel="False" FrozenColumnCount="1">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn Width="1500" Header="rgv1"  IsReadOnly="True" ></telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                                <telerik:RadGridView x:Name="rgv2" Grid.Row="1" Visibility="Collapsed" AutoGenerateColumns="False" SelectionMode="Extended">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn Width="1500" Header="rgv2" ></telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </Grid>
                        </telerik:RadTabItem.Content>
                    </telerik:RadTabItem>
                    <telerik:RadTabItem  Padding="4 1" DropDownContent="B" >
                        <telerik:RadTabItem.Header>
                            <TextBlock Text="B" Margin="19 2 19 0" FontSize="15"/>
                        </telerik:RadTabItem.Header>
                        <telerik:RadTabItem.Content>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" x:Name="stp3" Orientation="Horizontal">
                                    <ComboBox x:Name="cbshow3" Width="150">
                                        <ComboBoxItem IsSelected="True">1</ComboBoxItem>
                                        <ComboBoxItem>2</ComboBoxItem>
                                    </ComboBox>
                                    <Button Content="click" Click="Button_Click" Width="150" ></Button>
                                </StackPanel>
                                <telerik:RadGridView x:Name="rgv3" Grid.Row="1" AutoGenerateColumns="False" SelectionMode="Extended" SelectionUnit="FullRow"
                                 IsFilteringAllowed="False" CanUserFreezeColumns="False" ShowGroupPanel="False" FrozenColumnCount="1">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn Width="1500" Header="rgv1"  IsReadOnly="True" ></telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                                <telerik:RadGridView x:Name="rgv4" Grid.Row="1" Visibility="Collapsed" AutoGenerateColumns="False" SelectionMode="Extended">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn Width="1500" Header="rgv2" ></telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </Grid>
                        </telerik:RadTabItem.Content>
                    </telerik:RadTabItem>
                </telerik:RadTabControl>
            </Grid>
        </Grid>
    </UserControl>
    and the code codebehind:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    using Telerik.Windows.Controls;
    using System.IO;

    namespace SilverlightApplication1
    {
        public partial class MainPage12 : UserControl
        {
            public MainPage12()
            {
                InitializeComponent();
            }
      
            private void Button_Click(object sender, RoutedEventArgs e)
            {
     
                if (cbshow.SelectedIndex == 0)
                {
                    rgv1.Visibility = Visibility.Visible;
                    rgv2.Visibility = Visibility.Collapsed;
                }
                else
                {
                    rgv2.Visibility = Visibility.Visible;
                    rgv1.Visibility = Visibility.Collapsed;
                }
                }
        }
    }

     


  2. ABC
    ABC avatar
    15 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    I set gridview's height=gird.height-stackpanel.height,but it does not work,it says grid's height=NAN
Back to Top