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

RadWindow crash if not resized first

1 Answer 62 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michel Hardy
Top achievements
Rank 1
Michel Hardy asked on 25 Aug 2010, 10:01 PM
Hello,

I have a user control:

<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadDockPanel LastChildFill="True" Background="White">
        <telerikNavigation:RadToolBar telerik:RadDockPanel.Dock="Top" telerik:DockingPanel.Dock="Top">
            <telerikNavigation:RadToolBar.Items>
                <Button Name="btnPrint" Content="Print" />
                <Button Name="btnPrevious" Content="Previous" />
                <Button Name="btnNext" Content="Next" />
                <Slider Name="uiZoomSlider" Width="100" Minimum="0.2" Maximum="10" ValueChanged="uiZoomSlider_ValueChanged"
                                Value="1"/>
            </telerikNavigation:RadToolBar.Items>
        </telerikNavigation:RadToolBar>
        <ScrollViewer Name="scvDocument" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <telerik:LayoutTransformControl x:Name="ltDocument">
                <telerik:LayoutTransformControl.LayoutTransform>
                    <ScaleTransform x:Name="Scale"/>
                </telerik:LayoutTransformControl.LayoutTransform>
                <Viewbox Name="vbDocument">
                    <Border Name="DocumentContainer" BorderBrush="Gray" BorderThickness="1" />
                </Viewbox>
            </telerik:LayoutTransformControl>
        </ScrollViewer>
    </telerik:RadDockPanel>
</Grid>

Code behind of the user control:

private void uiZoomSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
    if (ltDocument != null)
    {
        ((ScaleTransform)ltDocument.LayoutTransform).ScaleX = e.NewValue;
        ((ScaleTransform)ltDocument.LayoutTransform).ScaleY = e.NewValue;
        ltDocument.ApplyLayoutTransform();
    }
}

I create a RadWindow and set its content with a new instance of my user control:

Telerik.Windows.Controls.RadWindow rw = new Telerik.Windows.Controls.RadWindow();
ucPrintPreview pp = new ucPrintPreview();
rw.Content = pp;
rw.CanClose = true;
rw.CanMove = true;
rw.IsRestricted = true;
rw.Header = "Print Preview";
rw.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterOwner;
CoaPrintDocument cpd = new CoaPrintDocument();
cpd.Height = 1024;
cpd.Width = 748;
pp.DocumentContainer.Child = (UIElement)cpd;
rw.ShowDialog();

When I show the RadWindow, if I move the slider control to zoom the viewbox. I get the following error (See error.jpg):
Line: 56
Error: Unhandled Error in Silverlight Application
Code: 4008   
Category: RuntimeError      
Message: Layout cycle detected.  Layout could not complete.    
MethodName:
     

But if I resize the RadWindow first and then move the slider control, it works without any error.

Anything to work around this problem?

Thank you,
Michel

1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 31 Aug 2010, 09:46 AM
Hi Michel Hardy,

Thank you for reporting this, your Telerik Points have been updated for your feedback.

The issue has been logged here:

http://www.telerik.com/support/pits.aspx#/public/silverlight/3258

Is it possible for you to set a MinHeight to the RadWindow? Then the layout cycle will not be there.

Greetings,
Miroslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Michel Hardy
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or