This is a migrated thread and some comments may be shown as answers.

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

1 Answer 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ABC
Top achievements
Rank 1
ABC asked on 02 Aug 2012, 03:24 AM
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;
            }
            }
    }
}

 


1 Answer, 1 is accepted

Sort by
0
ABC
Top achievements
Rank 1
answered on 02 Aug 2012, 03:28 AM
I set gridview's height=gird.height-stackpanel.height,but it does not work,it says grid's height=NAN
Tags
GridView
Asked by
ABC
Top achievements
Rank 1
Answers by
ABC
Top achievements
Rank 1
Share this question
or