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

RadWindow and "Dialog must be user-initiated" exception

10 Answers 170 Views
Window
This is a migrated thread and some comments may be shown as answers.
Lauren
Top achievements
Rank 1
Lauren asked on 18 May 2010, 03:35 PM
Hi,

Here is the scenario:
- there is a button to save a file on the disk
- on click, there is a call to the database
- when the call to the database is completed, a radwindow.Confirm opens (in order to have a user initiated event to open SaveFileDialog)

This used to work with the dlls version 2010.1.309.1030.
But since i updated my Telerik.Window.Controls dlls to version 2010.1.430.1030, i have now the exception "Dialog must be user-initiated" when trying to open the SaveFileDialog. I dont understand since IT IS user-initiated and used to work.

Has anyone seen this issue before ? Can you please help me with it?

Thank you very much.

10 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 20 May 2010, 01:12 PM
Hello Lauren,

 The difference is that we added built-in animations to the RadWindow control and this postpones the Closed event of the Confirm. This could be causing the error. You could disable the animations of the window control, used by the Confirm using the WindowStyle property of the Confirm method. In order to stop the animations you should set the AnimationManager.IsAnimationEnabled attached property to false.

Hope this helps.

Sincerely yours,
Miroslav Nedyalkov
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.
0
Lauren
Top achievements
Rank 1
answered on 20 May 2010, 02:47 PM
Hi,

Thank you for your answer.
However i'm not sure i understand where/how to do such a change.

I create the radwindow.Confirm in my xaml.cs file and I found the property WindowStyle.
But how do i set AnimationManager.IsAnimationEnabled to false ? i thought of doing it in App.xaml, Apllication.Resources, something like :

<

 

Style x:Key="NewWindowStyle"

 

 

TargetType="telerik:RadWindow">

 

 

 

<Setter Property="AnimationManger.IsAnimationEnabled"

 

 

Value="False" />

 

 

 

</Style>

 


but that's obviously not working and i'm not sure how to make it work.
Could you please send me a small example ?

Thanks so much.
Lauren
0
Lauren
Top achievements
Rank 1
answered on 24 May 2010, 03:04 PM
Hi,

Can anyone to help me with this please ?
I'd need to have the SaveFileDialog working as soon as possible.

Thanks for your help.
Lauren
0
Miroslav Nedyalkov
Telerik team
answered on 25 May 2010, 11:03 AM
Hi Lauren,

 You missed the namespace of the attached property. Please find the attached project.

Greetings,
Miroslav Nedyalkov
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.
0
Lauren
Top achievements
Rank 1
answered on 25 May 2010, 09:53 PM
Hi,

I tried to run your project but on initialisation, i get the following exception:

---------------------------------------------------
XamlParseException occured:
Invalid attribute value telerik:RadWindow for TargetType.
---------------------------------------------------

I'm using dlls version 2010.1.430.1030.

Any idea why it says that ?

Thanks.
Lauren
0
Lauren
Top achievements
Rank 1
answered on 25 May 2010, 11:31 PM
Hi again,

I actually managed to go over Initialization by using telerikNavigation:RadWindow instead of telerik:RadWindow in the targetType.
However i dont know if the style is actually applied since i still have the exception: "Dialog must be user-initiated"
Please find below a simplified sample:
on button click, a radwindow opens and on radwindow closing, i'd like the SaveFileDialog to open.

Thanks again

-----------------------
in App.xaml:
------

<

 

Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

 

x:Class="WindowStyleIssue.App"

 

 

 

xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"

 

 

 

xmlns:telerikAnimation="clr-namespace:Telerik.Windows.Controls.Animation;assembly=Telerik.Windows.Controls"

 

 

 

xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation">

 

 

 

<Application.Resources>

 

 

 

<!--Confirm Window Style-->

 

 

<Style x:Name="windowStyle"

 

TargetType="telerikNavigation:RadWindow">

 

<Setter Property="telerikAnimation:AnimationManager.IsAnimationEnabled"

 

 

Value="False" />

 

 

 

</Style>

 

 

 

</Application.Resources>

 

 

</

 

Application>
----------------------------
---------------------------
in MainPage.xaml:
---------------------------
<UserControl x:Class="WindowStyleIssue.MainPage"

 

 

 

 

 

 

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"

 

 

 

mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

 

 

 

<Grid x:Name="LayoutRoot">

 

 

 

<Button Content="Click here" Click="Button_Click" Height="40" Width="100"/>

 

 

 

</Grid>

 

 </

 

UserControl>
-----------------------------------
----------------------------------
in MainPage.xaml.cs:
----------------------------------
private void Button_Click(object sender, RoutedEventArgs e)

 

 {

 

 RadWindow.Confirm(new DialogParameters
 { WindowStyle = Application.Current.Resources["windowStyle"] as Style,
    Content =
"data has been downloaded from the server.\n Click OK to save it on your machine.",  
    Closed =
new EventHandler<WindowClosedEventArgs>(SaveDialog)
  });

 

 }

 

private void SaveDialog(object sender, WindowClosedEventArgs e)

 

{

 

   if (e.DialogResult == true)

    {

 

SaveFileDialog dialog = new SaveFileDialog()
        {

        Filter =

String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", "csv", "Comma Separated Values"),

 

        };

 

        if (dialog.ShowDialog() == true)

 

        {

 

        using (Stream stream = dialog.OpenFile()){}

 

        RadWindow.Alert("data has been saved. ");

 

        }

    }

}

 

 

 

0
Miroslav Nedyalkov
Telerik team
answered on 31 May 2010, 12:11 PM
Hello Lauren,

 Would you please open a support ticket and attach a sample project that reproduces the problem.

All the best,
Miroslav Nedyalkov
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.
0
Lauren
Top achievements
Rank 1
answered on 02 Jun 2010, 03:57 PM
Hi,

I finally found a work around this issue.
I call the SaveFileDialog before the asynchronous call to the database and record the Stream name in a global variable that i can use once the database call is completed.

Thanks for your help.

Regards,
Lauren
0
Kiran
Top achievements
Rank 2
answered on 11 Oct 2010, 11:18 AM
Hi Miroslav Nedyalkov,
 
I am also facing the same issue.
The solution provided by Lauren is working.

But disabling the animation is not working.
Are we missing something? Any updates?

Thanks
Kiran

0
Miroslav Nedyalkov
Telerik team
answered on 14 Oct 2010, 12:05 PM
Hi Kiran,

 Even when the animations are switched off, the window is still closed asynchronously. This is the reason for the error you are observing. Unfortunately we don't know about a good solution of this problem yet.

Best wishes,
Miroslav Nedyalkov
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
Lauren
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Lauren
Top achievements
Rank 1
Kiran
Top achievements
Rank 2
Share this question
or