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);
}
}
}
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);
}
}
}