4
可以說,我有兩個類是這樣的:如何從XAML中的靜態成員引用屬性?
public class LocalResources
{
public Color ForegroundColor { get; set; }
}
public static class OrganisationModule
{
public static LocalResources Resources = new LocalResources
{
ForegroundColor = Color.FromRgb(32, 32, 32)
};
}
在XAML代碼,爲什麼我能做到這一點不是(假設所有正確的XML命名空間的存在)?
<TextBlock Foreground="{x:Static Modules:OrganisationModule.Resources.ForegroundColor}" />
當我編譯,我得到的錯誤:Cannot find the type 'OrganisationModule.ColorManager'. Note that type names are case sensitive.
啊,!實際上,我不需要讓Resource成爲一個屬性,因爲它是靜態的,但除此之外,這絕對是我需要的答案。謝謝! – gerrod 2011-02-02 02:26:38