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

URGENT : RadWindow crashing when used as a User Control

16 Answers 212 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shiva
Top achievements
Rank 1
Shiva asked on 24 Aug 2011, 10:46 AM
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

16 Answers, 1 is accepted

Sort by
0
Shiva
Top achievements
Rank 1
answered on 24 Aug 2011, 12:39 PM
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
0
Konstantina
Telerik team
answered on 24 Aug 2011, 03:57 PM
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 >>

0
Alex
Top achievements
Rank 2
answered on 01 Sep 2011, 09:54 AM
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.
0
Ivo
Telerik team
answered on 06 Sep 2011, 07:55 AM
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 >>

0
Alex
Top achievements
Rank 2
answered on 06 Sep 2011, 11:18 AM
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.
0
Jarred Froman
Top achievements
Rank 1
answered on 06 Sep 2011, 03:57 PM
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
0
Miroslav Nedyalkov
Telerik team
answered on 08 Sep 2011, 11:44 AM
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 >>

0
Jarred Froman
Top achievements
Rank 1
answered on 08 Sep 2011, 03:38 PM
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
0
Valeri Hristov
Telerik team
answered on 08 Sep 2011, 04:09 PM
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 >>

0
Marcelo
Top achievements
Rank 1
answered on 12 Sep 2011, 02:00 PM
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.
0
George
Telerik team
answered on 15 Sep 2011, 05:09 PM
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 >>

0
Jarred Froman
Top achievements
Rank 1
answered on 15 Sep 2011, 05:23 PM
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
0
Gita
Top achievements
Rank 1
answered on 23 Sep 2011, 10:00 PM

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>
0
Yana
Telerik team
answered on 26 Sep 2011, 08:27 AM
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 >>

0
Gita
Top achievements
Rank 1
answered on 26 Sep 2011, 04:48 PM
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
0
Yana
Telerik team
answered on 27 Sep 2011, 10:53 AM
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 >>

Tags
Window
Asked by
Shiva
Top achievements
Rank 1
Answers by
Shiva
Top achievements
Rank 1
Konstantina
Telerik team
Alex
Top achievements
Rank 2
Ivo
Telerik team
Jarred Froman
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Valeri Hristov
Telerik team
Marcelo
Top achievements
Rank 1
George
Telerik team
Gita
Top achievements
Rank 1
Yana
Telerik team
Share this question
or