<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:ZB.MOM.WW.OtOpcUa.Client.UI.ViewModels"
             x:Class="ZB.MOM.WW.OtOpcUa.Client.UI.Views.BrowseTreeView"
             x:DataType="vm:BrowseTreeViewModel">
    <TreeView ItemsSource="{Binding RootNodes}"
              Name="BrowseTree"
              SelectionMode="Multiple">
        <TreeView.Styles>
            <Style Selector="TreeViewItem" x:DataType="vm:TreeNodeViewModel">
                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
            </Style>
        </TreeView.Styles>
        <TreeView.ItemTemplate>
            <TreeDataTemplate ItemsSource="{Binding Children}">
                <StackPanel Orientation="Horizontal" Spacing="6">
                    <TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center" />
                    <TextBlock Text="{Binding NodeClass}"
                               FontSize="10"
                               Foreground="Gray"
                               VerticalAlignment="Center" />
                    <ProgressBar IsIndeterminate="True"
                                 IsVisible="{Binding IsLoading}"
                                 Width="50"
                                 Height="8"
                                 VerticalAlignment="Center" />
                </StackPanel>
            </TreeDataTemplate>
        </TreeView.ItemTemplate>
    </TreeView>
</UserControl>