C# 如何在MarkupExtension中的DesignTime中获取静态资源值?

C# 如何在MarkupExtension中的DesignTime中获取静态资源值?,c#,wpf,xaml,markup-extensions,C#,Wpf,Xaml,Markup Extensions,我成功地创建了自己的MarkupExtension,我把它命名为“GtringResource”,它工作得很好,但在设计模式下没有 我在ProvideValue(IServieProvider ServiceProvider)中有以下代码: 我想返回运行时应该出现的值,因为我从合并字典中检索该值,如xaml中所示: <Button x:Name="downloadButton" Content="{intllectual:GtringResource downloadGtring}"/&

我成功地创建了自己的MarkupExtension,我把它命名为“GtringResource”,它工作得很好,但在设计模式下没有

我在ProvideValue(IServieProvider ServiceProvider)中有以下代码:

我想返回运行时应该出现的值,因为我从合并字典中检索该值,如xaml中所示:

<Button x:Name="downloadButton"  Content="{intllectual:GtringResource downloadGtring}"/>
尝试:


这太短了,没有帮助。我真的不确定约翰的建议是什么。我也不确定回到这个问题上来。如果子类化
StaticExtension
,则在设计时可能会提供不同的服务提供商?
<Button x:Name="downloadButton"  Content="{intllectual:GtringResource downloadGtring}"/>
/// ... when detect desingmode "IsDesingMode"
return ((Gtring)Application.Current.TryFindResource(GtringKey)).en;
/// ...
public class ResourceExtension : StaticExtension