WPF - Expander

Expander也算是一種容器,下面我們簡單的用程式碼來測試一下Expander的功能,執行結果畫面大概是像下面這樣

Expander也算是一種容器,下面我們簡單的用程式碼來測試一下Expander的功能,執行結果畫面大概是像下面這樣

Imports System.Windows
Imports System.IO
Imports System.Reflection
 
Class Window1
    Dim sp As StackPanel
    Dim exp As Expander
    Dim chsp As StackPanel
 
    Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        sp = New StackPanel
        Me.Content = sp
 
        chsp = New StackPanel
        For z As Integer = 0 To 4
            Dim rdo As New RadioButton
            rdo.Name = "rdo" & z
            rdo.Content = "RadioButton" & z
            chsp.Children.Add(rdo)
        Next
        exp = New Expander
        exp.Content = chsp
        exp.Background = Brushes.AliceBlue
        sp.Children.Add(exp)
        ''設定展開的方向
        ''exp.ExpandDirection = ExpandDirection.Right
        exp.Header = "Header"
    End Sub
End Class