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

Application Resources

1 Answer 205 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zhang
Top achievements
Rank 1
Zhang asked on 19 Jul 2013, 02:28 AM
hello
I have builder  a Telerik project as below,but when running  it went wrong,the errorMessage(InnerException) is  "Unable to find the name "mystyle" resources. The resource name is case-sensitive.",How can I achieve this?
thanks!
//RadElips.xaml
<telerik:RadWindow x:Class="WpfApplication1.RadElips"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
  Header="RadElips" Height="300" Width="300">
    <telerik:RadWindow.Resources>
        <!--<Style  x:Key="mystyle1" TargetType="{x:Type Control}" >
            <Setter Property="Background" Value="Black"></Setter>
            <Setter Property="Foreground" Value="WhiteSmoke"></Setter>
            <Setter Property="FontSize" Value="18"></Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver"  Value="True">
                    <Setter Property="Background" Value="Blue"></Setter>
                    <Setter Property="Foreground" Value="Green"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>-->
      
    </telerik:RadWindow.Resources>
    <Grid>
        <StackPanel>
            <Ellipse x:Name="elipse1" Stroke="Red" Height="120" Width="120"  StrokeThickness="6" Fill="Green"  ></Ellipse>
            <Button x:Name="btn01" Content="ok" Width="90" Height="38" Style="{StaticResource mystyle}"></Button>
        </StackPanel>
    </Grid>
</telerik:RadWindow>
//app.xaml
<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           >
    <Application.Resources>
        <Style x:Key="mystyle">
            <Setter Property="Control.Background" Value="Black"></Setter>
            <Setter Property="Control.Foreground" Value="White"></Setter>
        </Style>
    </Application.Resources>
</Application>
//app.xaml.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Telerik.Windows.Controls;
namespace WpfApplication1
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public App()
        {
            StyleManager.ApplicationTheme = new Windows8Theme();
        }
        protected override void OnStartup(StartupEventArgs e)
        {
         //Telerik Window - RadElips
            RadElips   radelips= new RadElips();
            radelips.Show();
            base.OnStartup(e);
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 23 Jul 2013, 01:40 PM
Hello Zhang,

Please check our reply in the other forum thread regarding RadWindow and implicit styles:
http://www.telerik.com/community/forums/wpf/general-discussions/show-radwindow-with-implict-style.aspx

If you move the "mystyle" Style inside MainRadWindowDictionary.xaml the current issue should be fixed.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
General Discussions
Asked by
Zhang
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or