URGENT : RadWindow crashing when used as a User Control

17 posts, 0 answers
  1. Shiva
    Shiva avatar
    61 posts
    Member since:
    Oct 2010

    Posted 24 Aug 2011 Link to this post

    Dear Community,

    We recently updated our telerik controls to the most latest internal build (deployed after Q2 2011 release) and since then we started facing below problem.

    How are we using RadWindow control?

    We are using RadWindow as a user control in our project. We took reference from this link:
    http://www.telerik.com/help/silverlight/radwindow-how-to-use-radwindow-as-user-control.html

    Our XAML file of this user control looks like:

    <telerik:RadWindow x:Class="OpsPortal.SL.Common.Controls.CustomRadWindow"
        mc:Ignorable="d" MinWidth="230" MinHeight="160"
        d:DesignHeight="300" d:DesignWidth="400"  
      
        <Grid x:Name="LayoutRoot" Background="White"          
        </Grid>
    </telerik:RadWindow>

    And our XAML.cs of this user control looks like:

    public partial class CustomRadWindow : RadWindow
        {
            public CustomRadWindow()
            {
                InitializeComponent();
            }
      
            public static void Prompt(string message, EventHandler<WindowClosedEventArgs> closedEventHandler)
            {
                RadWindow.Prompt(new DialogParameters
                {
                    Content = message,
                    Opened = OnAlertWindowOpened,
                    Closed = closedEventHandler
                });
            }
      
            public static void Alert(string message)
            {
                RadWindow.Alert(new DialogParameters
                {
                    Content = message,
                    Opened = OnAlertWindowOpened
                });
            }
      
            public static void Confirm(string message, EventHandler<WindowClosedEventArgs> closedEventHandler)
            {
                RadWindow.Confirm(new DialogParameters
                            {
                                Content = message,
                                //Include space so that the length of the buttons are the same otherwise by default Yes button has a shorter length
                                OkButtonContent = "       Yes         ",
                                CancelButtonContent = "No",
                                Opened = OnAlertWindowOpened,
                                Closed = closedEventHandler
                            });
            }
      
            private static void OnAlertWindowOpened(object sender, EventArgs e)
            {
                var window = sender as RadWindow;
                Style newStyle = App.Current.Resources["RadWindowStyle"] as Style;
                window.Style = newStyle;
            }
        }

    And we call this RadWindow from other pages in the project like this:

    CustomRadWindow.Confirm("This is an invalid data", new EventHandler<WindowClosedEventArgs>(OnConfirmExpressionsRefreshClosed));

    Everthing was working fine but recently after updating telerik controls, calling our RadWindow has started giving us below error:

    Error: Unhandled Error in Silverlight Application 
    Code: 2512    
    Category: ParserError       
    Message: Failed to create a 'System.Windows.Input.ICommand' from the text 'telerik:WindowCommands.Confirm'.     
    File:      
    Line: 820     
    Position: 18     

    I have read so many posts on telerik forums around issues in RadWindow control in latest build. This error is holding our project and is very critical for us.

    Can you please urgently let us know, what's wrong with it?? This is an urgent request so please share your response asap.

    Regards,
    Shiva
  2. Shiva
    Shiva avatar
    61 posts
    Member since:
    Oct 2010

    Posted 24 Aug 2011 Link to this post

    Dear Community,

    In addition to the problem statement described above, even if I try to use Telerik RadWindow simply in my code, even then it doesn't work. See below code snippet:

    RadWindow.Confirm("This is an invalid data", new EventHandler<WindowClosedEventArgs>(OnConfirmExpressionsRefreshClosed));OpsPortal.SL.Common.Utilities.HelperMethods.GetErrorMessage("Messages/GeneralMessages/SureRefreshData"), new EventHandler<WindowClosedEventArgs>(OnConfirmExpressionsRefreshClosed));

    This time, I'm not using the RadWindow user control and just trying to use the default RadWindow control as it is on my page. This thing also doesn't work.

    Any thoughts?? This is really urgent.

    Regards,
    Shiva
  3. DevCraft banner
  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 24 Aug 2011 Link to this post

    Hello Shiva,

    I tried to reproduce the issue, but to no avail. Attached I am sending you the sample project I used. Could you please review it and modify it in order to reproduce the problem. In that way we will be able to track down the source of the problem and provide a solution.

    Looking forward to your reply.

    Greetings,
    Konstantina
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  5. Alex
    Alex avatar
    13 posts
    Member since:
    Aug 2010

    Posted 01 Sep 2011 Link to this post

    Hello Konstantina,

        I just downloaded the 823 dev hotfix version of the controls and the sample project you provided here does not work. The project that I'm currently working on which starts with a RadWindow as a login view also does not work. I get an Object reference not se to an instance of an object when the window opens. Any ideas ?

    Alex.
  6. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 06 Sep 2011 Link to this post

    Hi Alex,

    Actually there is an issue with the RadWindow when shown just after InitializeComponent(). You can track its status in our PITS here. As a workaround I would suggest you to show the RadWindow into the Loaded event of your startup page.

    Also I want to inform you that it is not guaranteed you will get quickly an answer in our forums. If you need a quick reply, I strongly recommend using the support ticketing system instead.

    Kind regards,
    Ivo
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  7. Alex
    Alex avatar
    13 posts
    Member since:
    Aug 2010

    Posted 06 Sep 2011 Link to this post

    Hello,

    I have reverted back to the previous version of the controls so it's ok for now. It's just that the previous version has some issues with the RichTextBox so it's still frustrating a bit, but it's better to have the windows working.

    Thanks,
    Alex.
  8. Jarred Froman
    Jarred Froman avatar
    57 posts
    Member since:
    Aug 2008

    Posted 06 Sep 2011 Link to this post

    We are getting the same error when calling Radwindow.Confirm to show the confirm window.  Is a fix for this issue coming soon?

    Thanks,
    -Jarred
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 08 Sep 2011 Link to this post

    Hello Jarred,

     This issue is not scheduled yet, but we will try to fix it for the SP1 at the end of the month.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  10. Jarred Froman
    Jarred Froman avatar
    57 posts
    Member since:
    Aug 2008

    Posted 08 Sep 2011 Link to this post

    Hi Miroslav,

    Can this issue be escalated?  I can't imagine that this isn't considered a serious issue.  The simple usage of the confirm window is not functioning and it is used substantially throughout our own application.  We are going to release at the end of the month which will not leave us enough time for testing...

    Thanks,
    -Jarred
  11. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 08 Sep 2011 Link to this post

    Hi Jarred,

    We will do our best to fix this problem for Service Pack 1 after a couple of weeks. It is on top of our list, so unless we hit a major showstopper, the bug will be fixed on time for the release.

    Best wishes,
    Valeri Hristov
    Product Manager, XAML Teams
    Telerik

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  12. Marcelo
    Marcelo avatar
    28 posts
    Member since:
    Jul 2010

    Posted 12 Sep 2011 Link to this post

    Same here, version 2011.2.823.1040

    public virtual void Cancelar(object parameter)
           {
               DialogParameters oParameters = new DialogParameters();
               oParameters.CancelButtonContent = "Não";
               oParameters.OkButtonContent = "Sim";
               oParameters.Content = "Você vai perder todas as alterações não salvas nessa consulta. " + System.Environment.NewLine + "Deseja prosseguir?";
               oParameters.Header = "Aviso de Cancelamento";
     
               oParameters.Closed += new EventHandler<WindowClosedEventArgs>((s, args) =>
               {
                   if (args.DialogResult.Value == true)
                   {
                       this.CancelChangesContext();
                   }
               });
     
               RadWindow.Confirm(oParameters);
           }

    This is serious.
    Started with windows 7 not moving bug of Q2, and now this.
    "2 versions" without use for us.
  13. George
    Admin
    George avatar
    1332 posts

    Posted 15 Sep 2011 Link to this post

    Hi Marcelo,

    I would suggest opening the RadWindow in the Loaded event handler of the UserControl, not in the constructor. This will workaround the issue.

    All the best,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  14. Jarred Froman
    Jarred Froman avatar
    57 posts
    Member since:
    Aug 2008

    Posted 15 Sep 2011 Link to this post

    Hi Marcelo,

    Try the following workaround using the internal 2011_2_0912_DEV version (something like this worked for us):

    public virtual void Cancelar(object parameter)
    {
    DialogParameters oParameters = new DialogParameters();
    oParameters.CancelButtonContent = "Não";
    oParameters.OkButtonContent = "Sim";
    oParameters.Content = "Você vai perder todas as alterações não salvas nessa consulta. " + System.Environment.NewLine + "Deseja prosseguir?";
    oParameters.Header = "Aviso de Cancelamento";
     
               oParameters.Opened = (sender, e) =>
               {
                    var window = ((RadWindow)sender);
                    window.Dispatcher.BeginInvoke(window.BringToFront);
                }
    oParameters.Closed += new EventHandler<WindowClosedEventArgs>((s, args) =>
    {
    if (args.DialogResult.Value == true)
    {
    this.CancelChangesContext();
    }
    });
    RadWindow.Confirm(oParameters);
    }

    Hope that helps...
    Regards,
    -Jarred Froman
  15. Gita
    Gita avatar
    10 posts
    Member since:
    Sep 2011

    Posted 23 Sep 2011 Link to this post


    Dear Community,
    We are in the process of updating the Telerik controls from version 2009 to version of 2011 Q2. We are using Radwindow control inside the Usercontrol(for simplicity here Window is used) for more than 50 screens. We are having issues when we call the RadW indow ShowDialog Method saying :
    System.InvalidOperationException was unhandled
      Message=Specified element is already the logical child of another element. Disconnect it first.

    Is there any workaround for this issue?

    private void button2_Click(object sender, RoutedEventArgs e)

     

    {

    rad1.ShowDialog();

    }

     
    Below is the code for Window and the embedded RaWindow
    <Window x:Class="WpfApplication3.MainWindow"
            xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" 
            xmlns:grid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
            xmlns:sys="clr-namespace:System;assembly=mscorlib"
            xmlns:GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
            Title="MainWindow" Height="350" Width="525">
          
        <Window.Resources>
              
        </Window.Resources>
        <GroupBox>
            <StackPanel Name="mainPanel" Margin="5">
                <Button Name="button2" Content="_See Rad Window as child" Click="button2_Click"/>
      
                <telerik:RadWindow Name="rad1" Width="250" Visibility="Collapsed">
                <StackPanel Name="stck1" Visibility="Collapsed">
                        <TextBlock Text="Hello  "> </TextBlock>
                    <TextBlock Text="There!"></TextBlock>
                          
                    </StackPanel>
                </telerik:RadWindow>
      
      
      
            </StackPanel>
        </GroupBox>
    </Window>
  16. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 26 Sep 2011 Link to this post

    Hello Gita,

    Since Q2 2011 defining RadWindow directly in the XAML is not supported. You need to use the RadWindow as a UserControl as demonstrated in this help article.

    Hope this helps.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  17. Gita
    Gita avatar
    10 posts
    Member since:
    Sep 2011

    Posted 26 Sep 2011 Link to this post

    In our current project we are using version 2009 and used Radwindow inside our XAML file in more than 50 screens.
    It looks like version 2011 is not supported. Do we have to modify all the 50 screens by taking out the Radwindow part as a seperate usercontrol?
    It is going to be a big change in the production environment.
    Is there any other alternate way?

    Thanks again!!

    Gita
  18. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 27 Sep 2011 Link to this post

    Hello Gita,

    The problem is that previously we were doing a hack and when set in XAML, we were removing the RadWindow from its parent and then put it in a popup. Now we removed this hack, because it was causing problems to lots of clients when using it this way(losing of DataContext etc.). The right way is to declare the RadWindow as a root of an UserControl as shown in the help article or to declare it in code-behind.

    We're sorry for the caused inconvenience.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner