【发布时间】:2011-01-05 13:34:40
【问题描述】:
我对整个 Silverlight 是个新手。遇到了问题
我有一个从 Binding the Localizer 派生的类,声明如下:
public class Localizer : Binding
{
public Localizer()
{
}
private string _key;
/// <summary>
/// Localization key manager.
/// </summary>
public string Key
{
get { return _key; }
set
{
_key = value;
Source = LocalizationHelper.Current;
Path = new PropertyPath("Translations["+_key+"]");
}
}
}
当我在 XAML 页面中使用它时
<p:BasePage x:Class="Project.Pages.Desktop"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="clr-namespace:Project.Helpers">
<TextBlock Controls:DockPanel.Dock="Top" Text="{h:Localizer Key=UI_DSKTP_NAME}"/>
我遇到了一个错误
Type 'h:Localizer' is used like a markup extension but does not derive from MarkupExtension.
这个错误允许项目编译,并且绑定工作,但它很烦人。 你能帮我解决这个问题吗?
【问题讨论】:
标签: c# silverlight data-binding silverlight-4.0