0
두 종속성 속성, Value
및 MinVal
이 있습니다.
"값"의 기본값은 "MinVal"에 달려 있습니다.
"MinVal"은 xaml로 한 번만 설정합니다.
어떻게하면됩니까?종속성 속성 기본값은 다른 종속성 속성에 따라 다릅니다.
public int Value
{
get { return (int)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(int), typeof(NumericHexUpDown), new UIPropertyMetadata(0, ValueChanged));
private static void ValueChanged(object sender, DependencyPropertyChangedEventArgs e)
{
}
public int MinVal
{
get { return (int)GetValue(MinValProperty); }
set { SetValue(MinValProperty, value); }
}
// Using a DependencyProperty as the backing store for MinVal. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MinValProperty =
DependencyProperty.Register("MinVal", typeof(int), typeof(NumericHexUpDown), new UIPropertyMetadata(0, MinValueChanged));
private static void MinValueChanged(object sender, DependencyPropertyChangedEventArgs e)
{
}
C# 언어 사양은 우리에게 그 정적 a를 알려줍니다처럼 보인다 텍스트 순서로 초기화되므로 MinValProperty가 먼저 선언되도록 배열을 다시 시작하십시오. –
그리고 내가해야 할 일은 무엇입니까? 코드를 보여주세요 .. Thanks – cheziHoyzer
나는 아래의 강압 응답에 이미 투표했다. 그것은 완전히 강력한 전략입니다. –