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

RadWindow Styles not being applied

7 Answers 377 Views
Window
This is a migrated thread and some comments may be shown as answers.
Rakesh
Top achievements
Rank 1
Rakesh asked on 30 Apr 2012, 07:30 PM
I am using Intrinsic Styles to apply for all the controls in a project based on target type. I got it working for all the controls except RadWindow. I could see styles get applied in design view but when I run the project, it doesn't.
If I used Key - based Style it works.

Is there anyway I can use single style declaration apply to all my RadWindow's?

Thanks in Advance

~Raki

7 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 01 May 2012, 07:58 AM
Hi Rakesh,

There should be no problem applying an implicit style to RadWindow. Please, share where the style is located and how you are applying the style.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Rakesh
Top achievements
Rank 1
answered on 01 May 2012, 04:25 PM
HI Dani, Thanks for the response

<Style  TargetType="telerik:RadWindow">
    <Setter Property="Background" Value="#FF191616"/>
    <Setter Property="BorderBrush" Value="#701B1B1B" />
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="WindowStartupLocation" Value="CenterScreen"/>
    <Setter Property="ModalBackground">
        <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.5">
                <GradientStop Color="#E5000000"/>
                <GradientStop Color="#4C000000" Offset="0.5"/>
                <GradientStop Color="#7F000000" Offset="1"/>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect Color="WhiteSmoke" BlurRadius="10" ShadowDepth="0"/>
        </Setter.Value>
    </Setter>
</Style>

I declared the style at application level. I think any window in the application has to pic this styles when it renders without any manual resource declaration.
 Window has RadTabControl and RadGridView whose implicit styles got applied. If I use same window style with key attribute directly its working.

I couldn't figure out the issue. I really appreciate for you help.

Thanks
Rakesh
0
Rakesh
Top achievements
Rank 1
answered on 03 May 2012, 04:45 PM
I cannot get this working. Can anyone help me please.
0
Accepted
Dani
Telerik team
answered on 07 May 2012, 11:45 AM
Hello Rakesh,

If your RadWindow is created dynamically, the implicit style will apply fine:
RadWindow w = new RadWindow();
w.Width = 500;
w.Height = 500;
w.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
  
w.Show();


 But if you have included the RadWindow as a separate UserControl in your project  I am afraid the implicit style cannot be applied and you will need to apply a style explicitly using x:Key:
MyWindow w = new MyWindow();
w.Width = 500;
w.Height = 500;
w.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
  
w.Show();

I hope this helps.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Rakesh
Top achievements
Rank 1
answered on 07 May 2012, 10:58 PM
Hi Dani,

My Radwindow's are separate usercontrols in project. According to you the implicit styles doesn't apply in my case.
 The styles get applied when I use x:key attribute.

Thanks for the clarification & Thanks for you help.

Thanks
Rakesh
0
Kenneth
Top achievements
Rank 2
answered on 05 May 2013, 09:40 AM

I am also using implicit styles and radwindow as a usercontrol and the radwindow are invisible.

If I change Telerik.Window.Navigation.dll to a binary that contains xaml, then it works but that’s not preferable.

Should I write this in App.xml?:

 

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <Style x:Key="local:RadControlsScenario1" TargetType="telerik:RadWindow" BasedOn="{StaticResource RadWindowStyle}" />
 
        </ResourceDictionary>
    </Application.Resources>

And then this in my RadWindow UserControl?:
<telerik:RadWindow x:Class="FileMap.Views.UserCtrls.DialogCtrls.RadControlsScenario1"
        Header="RadControlsScenario1" Height="300" Width="300">
    <Grid>       
    </Grid>
</telerik:RadWindow>

With kind regards from Kenneth
0
Yana
Telerik team
answered on 07 May 2013, 07:57 AM
Hi Kenneth,

This is expected behavior - when using RadWindow as a User Control, it is of a new type and that's why it does not receive the implicit style automatically.  Please check the Note at the end of this article where it is explained how to handle this case.

I hope this helps.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Window
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Dani
Telerik team
Rakesh
Top achievements
Rank 1
Kenneth
Top achievements
Rank 2
Yana
Telerik team
Share this question
or