|
| 1 | +<controls:UserControlBase |
| 2 | + x:Class="StabilityMatrix.Avalonia.Views.Dialogs.SafetensorMetadataDialog" |
| 3 | + xmlns="https://github.com/avaloniaui" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls" |
| 6 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 7 | + xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs" |
| 8 | + xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" |
| 9 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 10 | + xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" |
| 11 | + xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core" |
| 12 | + xmlns:ui="using:FluentAvalonia.UI.Controls" |
| 13 | + d:DataContext="{x:Static mocks:DesignData.SafetensorMetadataViewModel}" |
| 14 | + d:DesignHeight="550" |
| 15 | + d:DesignWidth="700" |
| 16 | + x:DataType="dialogs:SafetensorMetadataViewModel" |
| 17 | + mc:Ignorable="d"> |
| 18 | + <Grid RowDefinitions="Auto,Auto,Auto"> |
| 19 | + <TextBlock |
| 20 | + Margin="8" |
| 21 | + HorizontalAlignment="Center" |
| 22 | + FontSize="24" |
| 23 | + FontWeight="SemiBold" |
| 24 | + Text="Safetensor Metadata" /> |
| 25 | + <TextBlock |
| 26 | + Grid.Row="1" |
| 27 | + Margin="8" |
| 28 | + HorizontalAlignment="Center" |
| 29 | + FontSize="16" |
| 30 | + FontWeight="SemiBold" |
| 31 | + Text="{Binding ModelName}" /> |
| 32 | + |
| 33 | + <TextBlock |
| 34 | + Grid.Row="2" |
| 35 | + Margin="10,20" |
| 36 | + HorizontalAlignment="Center" |
| 37 | + FontSize="16" |
| 38 | + FontStyle="Italic" |
| 39 | + IsVisible="{Binding Metadata, Converter={x:Static ObjectConverters.IsNull}}" |
| 40 | + Text="No Metadata" /> |
| 41 | + |
| 42 | + <Grid |
| 43 | + Grid.Row="2" |
| 44 | + IsVisible="{Binding Metadata, Converter={x:Static ObjectConverters.IsNotNull}}" |
| 45 | + RowDefinitions="Auto,Auto,Auto,Auto"> |
| 46 | + |
| 47 | + <!-- List of tags --> |
| 48 | + <TextBlock |
| 49 | + Grid.Row="0" |
| 50 | + Margin="8" |
| 51 | + HorizontalAlignment="Left" |
| 52 | + FontSize="16" |
| 53 | + FontWeight="SemiBold" |
| 54 | + IsVisible="{Binding Metadata.TagFrequency, Converter={x:Static ObjectConverters.IsNotNull}}" |
| 55 | + Text="Trained Tags" /> |
| 56 | + |
| 57 | + <ui:ItemsRepeater |
| 58 | + Grid.Row="1" |
| 59 | + Margin="8" |
| 60 | + IsVisible="{Binding Metadata.TagFrequency, Converter={x:Static ObjectConverters.IsNotNull}}" |
| 61 | + ItemsSource="{Binding Metadata.TagFrequency}"> |
| 62 | + <ui:ItemsRepeater.Layout> |
| 63 | + <ui:FlowLayout |
| 64 | + MinColumnSpacing="4" |
| 65 | + MinRowSpacing="4" |
| 66 | + Orientation="Horizontal" /> |
| 67 | + </ui:ItemsRepeater.Layout> |
| 68 | + <ui:ItemsRepeater.ItemTemplate> |
| 69 | + <DataTemplate> |
| 70 | + <Button |
| 71 | + Command="{Binding $parent[ui:ItemsRepeater].((dialogs:SafetensorMetadataViewModel)DataContext).CopyTagToClipboardCommand}" |
| 72 | + CommandParameter="{Binding Name}" |
| 73 | + Cursor="Hand"> |
| 74 | + <StackPanel Orientation="Horizontal"> |
| 75 | + <TextBlock FontWeight="SemiBold" Text="{Binding Name}" /> |
| 76 | + <TextBlock Margin="5,0,0,0" Text="{Binding Frequency}" /> |
| 77 | + </StackPanel> |
| 78 | + </Button> |
| 79 | + </DataTemplate> |
| 80 | + </ui:ItemsRepeater.ItemTemplate> |
| 81 | + </ui:ItemsRepeater> |
| 82 | + |
| 83 | + <!-- All other metadata --> |
| 84 | + <TextBlock |
| 85 | + Grid.Row="2" |
| 86 | + Margin="8" |
| 87 | + FontSize="16" |
| 88 | + FontWeight="SemiBold" |
| 89 | + Text="Other Metadata" /> |
| 90 | + <TextBlock |
| 91 | + Grid.Row="3" |
| 92 | + Margin="8" |
| 93 | + FontSize="16" |
| 94 | + FontStyle="Italic" |
| 95 | + IsVisible="{Binding !Metadata.OtherMetadata.Count}" |
| 96 | + Text="No Other Metadata" /> |
| 97 | + <ui:ItemsRepeater |
| 98 | + Grid.Row="3" |
| 99 | + Margin="8" |
| 100 | + IsVisible="{Binding !!Metadata.OtherMetadata.Count}" |
| 101 | + ItemsSource="{Binding Metadata.OtherMetadata}"> |
| 102 | + <ui:ItemsRepeater.ItemTemplate> |
| 103 | + <DataTemplate> |
| 104 | + <StackPanel Margin="5" Orientation="Vertical"> |
| 105 | + <TextBlock FontWeight="SemiBold" Text="{Binding Name}" /> |
| 106 | + <TextBlock Text="{Binding Value}" /> |
| 107 | + </StackPanel> |
| 108 | + </DataTemplate> |
| 109 | + </ui:ItemsRepeater.ItemTemplate> |
| 110 | + </ui:ItemsRepeater> |
| 111 | + </Grid> |
| 112 | + </Grid> |
| 113 | +</controls:UserControlBase> |
0 commit comments