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

RadAlert "Object reference not set" error in Blend

3 Answers 109 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 21 Jul 2011, 07:14 PM
Hello,

I'm attempting to template a RadAlert window. I've created a brand new Silverlight 4 project with the most recent Telerik controls. I added a rad alert (<telerik:RadAlert/>) to the page and blend immediately gives me an "Object reference not set to an instance of an object." error. I'm unable to create any template for the control.

Do you have any suggestions as to why this control seems to be incompatible with Blend?

Thanks,

Ryan Brown

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 22 Jul 2011, 10:13 AM
Hello Ryan,

Thank you for your feedback. We have logged this issue. It will be fixed as soon as possible. A fix will be available most probably in the upcoming LIB (expected on 25.07).

Meanwhile, I have attached a sample project that uses RadAlert and an implicit style available for modification.

I hope this will be helpful.

All the best,
Dani
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ryan
Top achievements
Rank 1
answered on 27 Jul 2011, 11:27 PM
Hello,

Thanks for the quick response. I've tried using it, but I'm not seeing the style you've included in the solution actually being used. I assume that this is because the "WindowStyle = Application.Current.Resources["RadAlertStyle"] as Style" line is commented out, and that the "RadAlertStyle" does not exist in the XAML. I've uncommmented this line and used it for the style you provided (<Style TargetType="telerikNavigation:RadAlert" x:Name="RadAlertStyle">), but I'm still not seeing the Alert window change. Do you have any suggestions?

Thanks,

Ryan Brown
0
Dani
Telerik team
answered on 28 Jul 2011, 09:12 AM
Hello Ryan,

The project which I sent aimed at applying an implicit style to the RadAlert dialog. The implicit styling worked well with assemblies 2011.1.704.1040 so basically in the attached project you did not have to do any additional modifications to make it work.
 
The commented out code referred to the case in which you might want to apply that style explicitly rather than implicitly. You just give the Style an x:Key="RadAlertStyle" and apply the style in the code-behind. One note: the line which sets style to the dialog should read:
ContentStyle = Application.Current.Resources["RadAlertStyle"] as Style
because the dialog is really content of a RadWindow.

And the line which sets explicit style to the RadWindow holding the dialog should read:
WindowStyle = Application.Current.Resources["RadAlertStyle"] as Style
 The is a discrepancy with the sent sample. I apologize for  that misunderstanding.

The real issue here is that currently the implicit styling is not working with version 2011.2.712.1040. I apologize for the inconvenience. We will look into the issue and will try to provide a fix in one of the nearest LIBs.

For now I suggest you use the following approach: apply the RadAlertStyle explicitly. First you need to have the style in App.xaml. Then, apply it from the code-behind:

private void RadButton_Click(object sender, RoutedEventArgs e)
       {
           RadWindow.Alert(new DialogParameters()
           {
               Content = "Hello",
               ContentStyle = Application.Current.Resources["RadAlertStyle"] as Style               
           });
            
       }

I hope this will give a solution to your issue. I will post an update as soon as we have fixes on the issues with the modal dialogs.

Best wishes,
Dani
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Window
Asked by
Ryan
Top achievements
Rank 1
Answers by
Dani
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or