fork download
  1. Imports System.Windows.Controls.Primitives
  2.  
  3.  
  4. Public Class TextBox2nd
  5. Inherits System.Windows.Controls.TextBox
  6.  
  7. Shared Sub New()
  8. 'この OverrideMetadata 呼び出しは、この要素が基本クラスと異なるスタイルを提供することをシステムに通知します。
  9. 'このスタイルは themes\generic.xaml に定義されています
  10. DefaultStyleKeyProperty.OverrideMetadata(GetType(TextBox2nd), New FrameworkPropertyMetadata(GetType(TextBox)))
  11. End Sub
  12.  
  13. Public Shared ReadOnly DateValueProperty As DependencyProperty = DependencyProperty.Register( _
  14. "DateValue", _
  15. GetType(Date?), _
  16. GetType(TextBox2nd), _
  17. New PropertyMetadata(), _
  18. New ValidateValueCallback(AddressOf DateChanged))
  19.  
  20. Public Property DateValue() As Date?
  21. Get
  22. Return DirectCast(GetValue(DateValueProperty), Date?)
  23. End Get
  24. Set(ByVal value As Date?)
  25. SetValue(DateValueProperty, value)
  26.  
  27. End Set
  28. End Property
  29.  
  30. 'エラーが消えない
  31. Private Shared Function DateChanged() As Boolean
  32. SetValue(TextProperty, DirectCast(GetValue(DateValueProperty), Date?))
  33. Return True
  34. End Function
  35. 'どっちもエラー
  36. Private Function DateChanged() As Boolean
  37. SetValue(TextProperty, DirectCast(GetValue(DateValueProperty), Date?))
  38. Return True
  39. End Function
  40.  
  41. End Class
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty