RadWindow and "Dialog must be user-initiated" exception

11 posts, 0 answers
  1. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 18 May 2010 Link to this post

    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.
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 20 May 2010 Link to this post

    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.
  3. DevCraft banner
  4. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 20 May 2010 Link to this post

    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
  5. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 24 May 2010 Link to this post

    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
  6. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 May 2010 Link to this post

    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.
  7. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 25 May 2010 Link to this post

    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
  8. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 25 May 2010 Link to this post

    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. ");

     

            }

        }

    }

     

     

     

  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 31 May 2010 Link to this post

    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.
  10. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 02 Jun 2010 Link to this post

    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
  11. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 11 Oct 2010 Link to this post

    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

  12. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 14 Oct 2010 Link to this post

    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
Back to Top
DevCraft banner