This question is locked. New answers and comments are not allowed.
I am currently referencing the new futures build that was released (RadControls for Silverlight 2008 3 1217 Futures).
I have a UserControl that I specify a MinHeight for the UserControl (it doesn't seem to matter if the MinHeight is set in the xaml or at runtime). This UserControl contains a RadGridView. When I use this UserControl as the Content of a RadWindow the initial state of the grid shows a vertical scroll bar and only displays one data row. Once I resize the window (make it larger even the slightest bit) the RadGridView displays the data rows correctly. However there is a side effect of this issue as well. If I scroll down a few records prior to the resize of the window the rows that I had scrolled by no longer show in the GridView (this issue also occurs if I do not specify a MinHeight on the UserControl). It also seems as if the vertical scrollbars will never come back when resizing the window to smaller than the data.
I have provided a sample below of the issue I am having.
Is this a known issue? If so is there currently a work around?
Thank you for your help.
- Jeremy
Page.xaml
Page.xaml.cs
ExampleGrid.xaml
ExampleGrid.xaml.cs
I have a UserControl that I specify a MinHeight for the UserControl (it doesn't seem to matter if the MinHeight is set in the xaml or at runtime). This UserControl contains a RadGridView. When I use this UserControl as the Content of a RadWindow the initial state of the grid shows a vertical scroll bar and only displays one data row. Once I resize the window (make it larger even the slightest bit) the RadGridView displays the data rows correctly. However there is a side effect of this issue as well. If I scroll down a few records prior to the resize of the window the rows that I had scrolled by no longer show in the GridView (this issue also occurs if I do not specify a MinHeight on the UserControl). It also seems as if the vertical scrollbars will never come back when resizing the window to smaller than the data.
I have provided a sample below of the issue I am having.
Is this a known issue? If so is there currently a work around?
Thank you for your help.
- Jeremy
Page.xaml
| <UserControl x:Class="WindowExample.Page" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:WindowExample="clr-namespace:WindowExample" |
| > |
| <Grid x:Name="LayoutRoot" > |
| <Grid.RowDefinitions> |
| <RowDefinition Height="50"/> |
| <RowDefinition Height="*"/> |
| </Grid.RowDefinitions> |
| <StackPanel Grid.Row="0"> |
| <Button x:Name="OpenMinHeightWindowButton" Content="Open Min Height Window" Width="150" Height="25" Click="OpenMinHeightWindowButton_Click"/> |
| <Button x:Name="OpenNewWindowButton" Content="Open New Window" Width="150" Height="25" Click="OpenNewWindowButton_Click"/> |
| </StackPanel> |
| <WindowExample:ExampleGrid x:Name="ExampleGridView" Grid.Row="1"/> |
| </Grid> |
| </UserControl> |
Page.xaml.cs
| using System.Windows; |
| using System.Windows.Controls; |
| using Telerik.Windows.Controls; |
| namespace WindowExample { |
| public partial class Page : UserControl { |
| public Page() { |
| InitializeComponent(); |
| } |
| private void OpenMinHeightWindowButton_Click(object sender, RoutedEventArgs e) { |
| GetNewWindow(new ExampleGrid(){MinHeight = 400}).Show(); |
| } |
| private void OpenNewWindowButton_Click(object sender, RoutedEventArgs e) { |
| GetNewWindow(new ExampleGrid()).Show(); |
| } |
| private RadWindow GetNewWindow(object WindowContent) { |
| RadWindow NewWindow = new RadWindow(); |
| NewWindow.Content = WindowContent; |
| NewWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
| NewWindow.PreviewClosed += NewWindow_PreviewClosed; |
| NewWindow.PreviewHidden += NewWindow_PreviewHidden; |
| return NewWindow; |
| } |
| private void NewWindow_PreviewHidden(object sender, WindowPreviewHiddenEventArgs e) { |
| this.Focus(); |
| } |
| void NewWindow_PreviewClosed(object sender, WindowPreviewClosedEventArgs e) { |
| this.Focus(); |
| } |
| } |
| } |
ExampleGrid.xaml
| <UserControl x:Class="WindowExample.ExampleGrid" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" |
| > |
| <Grid x:Name="LayoutRoot" > |
| <Controls:RadGridView Name="sampleRadGridView" ColumnsWidthMode="Fill" AutoGenerateColumns="False" ShowGroupPanel="False"> |
| <Controls:RadGridView.Columns> |
| <GridView:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding ContactName}"> |
| <GridView:GridViewDataColumn.CellStyle> |
| <Style TargetType="GridView:GridViewCell"> |
| <Setter Property="Template"> |
| <Setter.Value> |
| <ControlTemplate> |
| <Button x:Name="ActionButton" Content="Some Action" Click="ActionButton_Click"> </Button> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| </Style> |
| </GridView:GridViewDataColumn.CellStyle> |
| </GridView:GridViewDataColumn> |
| <GridView:GridViewDataColumn HeaderText="CustomerID" IsReadOnly="True" UniqueName="CustomerID" /> |
| <GridView:GridViewDataColumn HeaderText="CompanyName" IsReadOnly="True" UniqueName="CompanyName" /> |
| <GridView:GridViewDataColumn HeaderText="Country" UniqueName="Country" /> |
| <GridView:GridViewDataColumn HeaderText="City" UniqueName="City" /> |
| <GridView:GridViewDataColumn HeaderText="ContactName" UniqueName="ContactName" /> |
| </Controls:RadGridView.Columns> |
| </Controls:RadGridView> |
| </Grid> |
| </UserControl> |
ExampleGrid.xaml.cs
| using System.Collections.ObjectModel; |
| using System.Windows.Controls; |
| namespace WindowExample { |
| public partial class ExampleGrid : UserControl { |
| private ObservableCollection<Customer> dataSource = new ObservableCollection<Customer>(); |
| public ExampleGrid() { |
| InitializeComponent(); |
| SetCustomerDataSource(); |
| this.sampleRadGridView.ItemsSource = this.dataSource; |
| } |
| private void SetCustomerDataSource() { |
| for (int i = 0; i < 10; i++) { |
| Customer aCustomer = new Customer(); |
| aCustomer.CustomerID = i.ToString(); |
| aCustomer.ContactName = "Customer " + i.ToString(); |
| dataSource.Add(aCustomer); |
| } |
| } |
| private void ActionButton_Click(object sender, System.Windows.RoutedEventArgs e) { |
| //Perform some action |
| } |
| } |
| public class Customer { |
| public string CustomerID { get; set; } |
| public string CompanyName { get; set; } |
| public string Country { get; set; } |
| public string City { get; set; } |
| public string ContactName { get; set; } |
| public bool Bool { get; set; } |
| } } |