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

InvalidOptionExecption when calling ShowDialog

3 Answers 66 Views
Window
This is a migrated thread and some comments may be shown as answers.
john.thomas
Top achievements
Rank 1
john.thomas asked on 15 Aug 2008, 04:09 PM
Perhaps I'm doing this incorrect but I am able to call .ShowDialog()  which displays my window correctly, then in response to some even close the window calling .Close().  If I try to reopen window with ShowDialog() again I get an "InvalidOptionException You cannot hide or show a window which has already been closed"  

If I Hide() the window instead and reopen it, it opens in a much smaller size than it orginally displayed.

What is the difference between the Close and Hide methods? 

Am I doing something incorrect, I see this working in the examples using the hide to restore the window correctly so I am assuming it is not a bug.

Thanks for your help,

J

3 Answers, 1 is accepted

Sort by
0
Hristo Borisov
Telerik team
answered on 18 Aug 2008, 08:55 AM
Hi John,

First of all, I want to to apologize for the late response. I am unable to produce your issue with the size of RadWindow. What is the content that you use in RadWindow? 

The difference between Hide and Close is similar to the one in WPF. For temporarily hiding a control you should use Hide. For permanently closing a window, you should use Close method that removes the control reference from the RadWindowManager, and disposes all internal memory set aside for it. This is why, you get InvalidOperationException whenever Show or ShowDialog is called on a previously closed window.

We are still trying to improve the behavior of RadWindow in order to achieve the best user experience. Would you elaborate some more on your scenarios, so that we can consider whether the WPF behavior we currently follow is the most appropriate for RadWindow.

Kind regards,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
john.thomas
Top achievements
Rank 1
answered on 18 Aug 2008, 01:10 PM
OK I understand the difference I was just confused becuase I could not create a new instance of the window. 

In terms of the window not displaying correctly. All I have a Grid with TextBlock, a TextBox, and a couple of buttons.  This is just a little sample project I am messing with so I'd be happy to pass on my solution and code to you.

<Telerik_Windows_Controls:RadWindow x:Name="window" Header="RadWindow" Opened="window_Opened"WindowStartupLocation="CenterParent" LeftOffset="-150" TopOffset="-50" Width="300" Height="300">
<Grid>
<Grid.RowDefinitions>
    <RowDefinition />
    <RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition />
    <ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Text="First Name:"/>
<TextBox x:Name="tbFirstName" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Width="120" Grid.Column="1"/>
<Button x:Name="btnSave" Width="80" Content="Save" Height="24" Click="btnSave_Click"VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Margin="5"/>
<Button x:Name="btnCancel" Width="80" Height="24" Click="btnCancel_Click" Content="Cancel"VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Margin="5"/>
</Grid>
</Telerik_Windows_Controls:RadWindow>

Thanks for your help,

J

0
Accepted
Hristo Borisov
Telerik team
answered on 19 Aug 2008, 08:48 AM
Hello John,

It turned out that the WindowAnimation property has some bugs. To show your RadWindow with the correct size, you can set WindowAnimation = WindowAnimation.OnShow and it will behave the same way as the online demo. The bug will be fixed with our next SP1 release due end of August.

As a result of your bug report, your Telerik's points have been updated as per our EAP Program.

Sincerely yours,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
john.thomas
Top achievements
Rank 1
Answers by
Hristo Borisov
Telerik team
john.thomas
Top achievements
Rank 1
Share this question
or