WPF VB.Net Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="250" Width="300">
    
                          Content="Third CheckBox (Tri-State Enabled)" 
                  Indeterminate="CheckBox_Indeterminate"  IsChecked="True" 
                  IsThreeState="True" Margin="2" Name="checkbox3" 
                  />
                        Click="Button_Click" />
        
        
    

//File:Window.xaml.vb
Imports System.Linq
Imports System.Windows
Imports System.Windows.Controls
Namespace WpfApplication1
  Public Partial Class Window1
    Inherits Window
    Public Sub New()
      InitializeComponent()
    End Sub
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
      listbox.Items.Clear()
      For Each checkbox As CheckBox In panel.Children.OfType(Of CheckBox)().Where(Function(cb) cb.IsChecked = True)
        listbox.Items.Add(checkbox.Name)
      Next
    End Sub
    Private Sub CheckBox_Indeterminate(sender As Object, e As RoutedEventArgs)
      If Not IsInitialized Then
        Return
      End If
      Dim checkbox As CheckBox = TryCast(e.OriginalSource, CheckBox)
      If checkbox IsNot Nothing Then
        MessageBox.Show(checkbox.Name & " is indeterminate.", Title)
      End If
    End Sub
  End Class
End Namespace