【发布时间】:2011-03-10 23:13:59
【问题描述】:
我有一类附加属性:
public static class XamlProps
{
#region Attached Properties
private static readonly DependencyProperty FooProperty = DependencyProperty.RegisterAttached(
"Foo",
typeof(string),
typeof(XamlProps),
null);
public static void SetFoo(DependencyObject obj, string action)
{
obj.SetValue(FooProperty, action);
}
}
我在我的 XAML 中使用这些属性:
<Border me:XamlProps.Foo="Foo to the Bar">
但现在我想在这个属性中设置一个更大的值,所以我想把它用作一个元素:
<Border>
<me:XamlProps.Foo>Foo to the Bar</me:XamlProps.Foo>
</Border>
但现在 Silverlight 不再调用 SetFoo()。我如何让它发挥作用?
如果重要的话,在 Windows Phone 7 上。
【问题讨论】:
标签: c# silverlight xaml windows-phone-7