RadWindow Styles not being applied

8 posts, 1 answers
  1. Rakesh
    Rakesh avatar
    19 posts
    Member since:
    Feb 2012

    Posted 30 Apr 2012 Link to this post

    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

  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 01 May 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Rakesh
    Rakesh avatar
    19 posts
    Member since:
    Feb 2012

    Posted 01 May 2012 Link to this post

    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
  5. Rakesh
    Rakesh avatar
    19 posts
    Member since:
    Feb 2012

    Posted 03 May 2012 Link to this post

    I cannot get this working. Can anyone help me please.
  6. Answer
    Dani
    Admin
    Dani avatar
    848 posts

    Posted 07 May 2012 Link to this post

    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 >>
  7. Rakesh
    Rakesh avatar
    19 posts
    Member since:
    Feb 2012

    Posted 07 May 2012 Link to this post

    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
  8. Kenneth
    Kenneth avatar
    27 posts
    Member since:
    Nov 2010

    Posted 05 May 2013 Link to this post

    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
  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 07 May 2013 Link to this post

    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.

Back to Top
DevCraft banner