【发布时间】:2010-02-17 17:49:53
【问题描述】:
我在从 Silverlight 应用程序中的 UserControl 访问应用程序资源时遇到问题。这是我的用户控件:
<UserControl x:Class="MyApp.MainControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" >
<basics:TabControl TabStripPlacement="Left">
<basics:TabItem Name="tabHome" Header="Home"></basics:TabItem>
<basics:TabItem Name="tabPatients" Header="{StaticResource My_Patients}"></basics:TabItem>
<basics:TabItem Name="tabOrganization" Header="My Organization"></basics:TabItem>
</basics:TabControl>
</UserControl>
我在将 tabPatients 选项卡的 Header 属性设置为静态资源 My_Patients 的那一行出现错误。
这是我的申请文件:
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
x:Class="MyApp.App">
<Application.Resources>
<System:String x:Key="My_Patients">All My Patients</System:String>
</Application.Resources>
</Application>
谁能告诉我怎么回事?
【问题讨论】:
-
看不出有什么问题,在我的机器上运行良好。