So I am currently working with custom silverlight extensions for a SAP application.

The extension kicks off a an async WCF request and waits for the response.

During which time I try the following:

                    waitWindow = new RadWindow();
                    waitWindow.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
                    waitWindow.BorderThickness = new Thickness(0);
                    waitWindow.Content = new View.WaitWindowTest();
                    waitWindow.ShowDialog();

Where View.WaitWindowTest is a UserControl with the standard C# constructor behind it:

<UserControl
    x:Class="censored.View.WaitWindowTest"
    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" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="50">

    <Grid x:Name="LayoutRoot">

        <Grid.Resources>
            <Style x:Key="BorderlessWindowStyle" TargetType="telerikNavigation:RadWindow">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerikNavigation:RadWindow">
                            <Border BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}">
                                <ContentPresenter Margin="{TemplateBinding Padding}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <telerikNavigation:RadWindow x:Name="Window1" Style="{StaticResource BorderlessWindowStyle}" Width="300" Height="50" Padding="50,15,0,0" >
            <TextBlock FontSize="15">Processing, please wait...</TextBlock>
        </telerikNavigation:RadWindow>
    </Grid>
</UserControl>

However when I run the above code I get the following error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 28 Oct 2014 12:47:13 UTC


Message: Unhandled Error in Silverlight 3 Application: RadWindow control needs to be displayed using its Show or ShowDialog method and shouldn't be added to the layout.
Line: 1
Char: 1
Code: 0
URI: http://localhost/censored/Silverlight.js


Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.InvalidOperationException: RadWindow control needs to be displayed using its Show or ShowDialog method and shouldn't be added to the layout.
   at Telerik.Windows.Controls.RadWindow.OnApplyTemplate()
   at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)     

Line: 62
Char: 13
Code: 0
URI: http://localhost/sensored/default.aspx

Does anybody know what I am doing wrong? Fairly new to silverlight and MVVM and the code was based off existing code I had.

It was an attempt based off the code provided in the following link: http://www.telerik.com/forums/radwindow-no-borders

Recommended Answers

All 4 Replies

From the error I assume you need to define your WaitWindow in XAML.

Can you point me in the direction of some form of guidance in how to do that Prit? Not done before in terms of modifying a RadWindow template

If you manually add <RadWindow> to your usercontrol XAML and define it's properties there, technically the Show should work then. It might need a prefix, but not sure what you are using for Telerik components.

Ok shall give it a go, seem to have found another way to do it that has the border but no close button etc.

For the moment I am settling for that due to deadlines and I need to finalise some functionality first. I will revisit this if I get time and let you know the outcome.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.