-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComboBoxEx.vb
More file actions
51 lines (38 loc) · 1.47 KB
/
ComboBoxEx.vb
File metadata and controls
51 lines (38 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Imports System.Windows.Controls.Primitives
''' <summary>
''' A custom ComboBox that gives direct access to the textbox and popup.
''' </summary>
Public Class ComboBoxEx
Inherits System.Windows.Controls.ComboBox
Public Shared TextBoxProperty As DependencyProperty = DependencyProperty.RegisterAttached("TextBox", GetType(TextBox), GetType(ComboBoxEx))
Public Property TextBox As TextBox
Get
Return CType(GetValue(TextBoxProperty), TextBox)
End Get
Set(value As TextBox)
SetValue(TextBoxProperty, value)
End Set
End Property
Public Shared PopupProperty As DependencyProperty = DependencyProperty.RegisterAttached("Popup", GetType(Popup), GetType(ComboBoxEx))
Public Property Popup As Popup
Get
Return CType(GetValue(PopupProperty), Popup)
End Get
Set(value As Popup)
SetValue(PopupProperty, value)
End Set
End Property
Public Sub New()
MyBase.New
End Sub
Public Overrides Sub OnApplyTemplate()
MyBase.OnApplyTemplate()
TextBox = TryCast(MyBase.GetTemplateChild("PART_EditableTextBox"), TextBox)
If TextBox IsNot Nothing Then
TextBox.VerticalContentAlignment = VerticalAlignment.Center
End If
Popup = TryCast(MyBase.GetTemplateChild("PART_Popup"), Popup)
If Popup IsNot Nothing Then
End If
End Sub
End Class