When I create a XamWebDialogWindow in code and set the RestrictInContainer to true and add the dialog to a StackPanel, I get "Layout Cycle Detected. Layout could not complete" error. If I set WindowState to Normal, then the window appears within the container. But when maximizing, Iam getting run time error.
XamWebDialogWindow myDialogWindow = new XamWebDialogWindow() { Width = 100, Height = 100, StartupPosition = StartupPosition.Center, WindowState = WindowState.Maximized };myDialogWindow.RestrictInContainer = true;testStackPanel.Children.Add(myDialogWindow);
Thanks, Sundar.
Hi Sundar, This snippet works properly in my application. Maybe you update the layout in some way in work code .
Can You send me more detailed snippet?
Thanks!
Mihail
Mihail, Thanks for looking into the issue immediately.
<navigation:Page xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:igTileView="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebTileView.v9.1" x:Class="Test.Home" 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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" Title="Home" Style="{StaticResource PageStyle}" >
<Grid x:Name="LayoutRoot"> <controlsToolkit:DockPanel LastChildFill="True"> <StackPanel Orientation="Horizontal" controlsToolkit:DockPanel.Dock="Bottom" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TextBlock Text="Bottom"></TextBlock> </StackPanel> <StackPanel Orientation="Horizontal" controlsToolkit:DockPanel.Dock="Top" HorizontalAlignment="Stretch" x:Name="testStackPanel" Background="AliceBlue" MouseLeftButtonDown="test_MouseLeftButtonDown"> <TextBlock Text="Top"></TextBlock> </StackPanel> </controlsToolkit:DockPanel> </Grid>
</navigation:Page>
//////////////////////C# Code//////////////////////////
private void test_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { XamWebDialogWindow myDialogWindow = new XamWebDialogWindow() { Width = 100, Height = 100, StartupPosition = StartupPosition.Center, WindowState = WindowState.Maximized}; myDialogWindow.RestrictInContainer = true;
testStackPanel.Children.Add(myDialogWindow); }
When I click on the alice blue area, I get the error.
Hi SIndar, When You use event handler to add an Window instance in StackPanel in this application is this issue. Can You change testStackPanel to be from Grid type?
Mihail,
After changing the stackpanel to grid, the maximize option started working.