我想這是因爲Canvas.Left附加屬性,並檢索他們試試這個:
private DependencyProperty GetAttachedProperty(DependencyObject obj, string propertyName, Type ownerType)
{
foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(obj,
new Attribute[] { new PropertyFilterAttribute(PropertyFilterOptions.All) }))
{
DependencyPropertyDescriptor dpd =
DependencyPropertyDescriptor.FromProperty(pd);
if (dpd != null && dpd.IsAttached)
{
if (string.Compare(dpd.DependencyProperty.Name, propertyName, StringComparison.CurrentCultureIgnoreCase) == 0 && dpd.DependencyProperty.OwnerType == ownerType)
{
return dpd.DependencyProperty;
}
}
}
return null;
}
Source
工作現在我,謝謝! :) – chris6523 2012-07-18 08:43:15