0
我已經擴展this example for a RadialPanel與StartPosition
LayoutDirection
依賴屬性:當我更改這些DependencyProperty值時,爲什麼不更新設計器?
public class RadialPanel : Panel
{
public RadialPanel()
{
StartPosition = StartPosition.Top;
LayoutDirection = LayoutDirection.Clockwise;
}
public StartPosition StartPosition
{
get { return (StartPosition)GetValue(StartPositionProperty); }
set { SetValue(StartPositionProperty, value); }
}
public static readonly DependencyProperty StartPositionProperty =
DependencyProperty.Register("StartPosition", typeof(StartPosition), typeof(RadialPanel), new PropertyMetadata(StartPosition.Top));
public LayoutDirection LayoutDirection
{
get { return (LayoutDirection)GetValue(LayoutDirectionProperty); }
set { SetValue(LayoutDirectionProperty, value); }
}
public static readonly DependencyProperty LayoutDirectionProperty =
DependencyProperty.Register("LayoutDirection", typeof(LayoutDirection), typeof(RadialPanel), new PropertyMetadata(LayoutDirection.Clockwise));
// ... code from cited article
}
StartPosition
和LayoutDirection
值是枚舉:
public enum StartPosition
{
Left = 180, Top = 90, Right = 0, Bottom = -90
}
public enum LayoutDirection
{
Clockwise = -1, CounterClockwise = 1
}
數學的作品,一切都刷新時我建立項目,但我認爲使用依賴項屬性會在更改XAML中的值時自動更新設計器:
<local:RadialPanel StartPosition="Top"
LayoutDirection="CounterClockwise" >
......但它沒有。它會在我更換RadialPanel的Children時更新,但就是這樣。
如何啓用此功能?
是的,項目代碼已啓用......但那只是運氣。 –