Bir ValidateValueCallback eklendi validateValue (nesne değeri)? Herhangi bir ipucu için teşekkürler!DependencyProperty ValidateValueCallback soru
örnek kod:
class ValidateTest : DependencyObject
{
public static DependencyProperty AProperty = DependencyProperty.Register("A", typeof(double), typeof(ValidateTest), new PropertyMetadata(), validateValue);
public static DependencyProperty BProperty = DependencyProperty.Register("B", typeof(double), typeof(ValidateTest));
static bool validateValue(object value)
{
// Given value shall be greater than 0 and smaller than B - but how to access the value of B?
return (double)value > 0 && value <= /* how to access the value of B ? */
}
}
bu detaylı cevap için çok teşekkür ederiz! Cevap olarak işaretlendi. İlk olarak bu şekilde alışmak zorunda kaldım (bir istisna atmadan), ama iyi, "resmi" yol gibi görünüyor. –