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 noticed a difference in the startup size for a RadWindow when calling ShowDialog() vs Show(). The Show() initializes the window to the 'minimum' size of the user control within the window (this is the behavior I prefer) where as ShowDialog() initializes the window to be the maximum size of the browser window.
Is this expected behavior? Is there a way to have the ShowDialog() behave like the Show() intial size?
Below is a code sample.
Thank you for your help.
- Jeremy
Page.xaml
Page.xaml.cs
ExampleGrid.xaml
ExampleGrid.xaml.cs
I have noticed a difference in the startup size for a RadWindow when calling ShowDialog() vs Show(). The Show() initializes the window to the 'minimum' size of the user control within the window (this is the behavior I prefer) where as ShowDialog() initializes the window to be the maximum size of the browser window.
Is this expected behavior? Is there a way to have the ShowDialog() behave like the Show() intial size?
Below is a code sample.
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" |
| > |
| <Grid x:Name="LayoutRoot" > |
| <StackPanel> |
| <Button x:Name="OpenModalWindowButton" Content="Open Modal Window" Width="150" Height="25" Click="OpenModalWindowButton_Click"/> |
| <Button x:Name="OpenNewWindowButton" Content="Open New Window" Width="150" Height="25" Click="OpenNewWindowButton_Click"/> |
| </StackPanel> |
| </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 OpenModalWindowButton_Click(object sender, RoutedEventArgs e) { |
| GetNewWindow().ShowDialog(); |
| } |
| private void OpenNewWindowButton_Click(object sender, RoutedEventArgs e) { |
| GetNewWindow().Show(); |
| } |
| private RadWindow GetNewWindow() { |
| RadWindow NewWindow = new RadWindow(); |
| NewWindow.Content = new ExampleGrid(); |
| 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" |
| MinHeight="200"> |
| <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; |
| using System.Collections.ObjectModel; |
| using System.Windows.Controls; |
| using Telerik.Windows; |
| using Telerik.Windows.Controls.GridView; |
| using Telerik.Windows.Controls.GridView.Rows; |
| namespace WindowExample { |
| public partial class ExampleGrid : UserControl { |
| private ObservableCollection<Customer> dataSource = new ObservableCollection<Customer>(); |
| public ExampleGrid() { |
| InitializeComponent(); |
| SetCustomerDataSource(); |
| this.sampleRadGridView.AddHandler(GridViewRow.EditEndedEvent, new EventHandler<RecordRoutedEventArgs>(this.OnEditEnded)); |
| this.sampleRadGridView.ItemsSource = this.dataSource; |
| } |
| private void OnEditEnded(object sender, RecordRoutedEventArgs e) { |
| } |
| 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; } |
| }} |