|
4 | 4 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 | 5 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
6 | 6 | xmlns:local="clr-namespace:OnnxStack.UI.Dialogs" |
| 7 | + xmlns:models="clr-namespace:OnnxStack.UI.Models" |
7 | 8 | xmlns:userControls="clr-namespace:OnnxStack.UI.UserControls" |
8 | 9 | mc:Ignorable="d" |
9 | 10 | Name="UI" |
|
15 | 16 | UseLayoutRounding="True" |
16 | 17 | Style="{StaticResource BaseWindow}" |
17 | 18 | ContentRendered="OnContentRendered" |
18 | | - Title="Add Model"> |
| 19 | + Title="Add StableDiffusion Model"> |
19 | 20 | <DockPanel DataContext="{Binding ElementName=UI}" Margin="15, 15, 15, 10"> |
20 | 21 | <StackPanel DockPanel.Dock="Top"> |
21 | 22 |
|
22 | | - <UniformGrid Columns="2"> |
23 | | - <StackPanel> |
24 | | - <TextBlock Text="Model Pipeline"/> |
25 | | - <ComboBox ItemsSource="{Binding Source={StaticResource DiffuserPipelineType}}" SelectedItem="{Binding PipelineType}" /> |
26 | | - </StackPanel> |
27 | | - <StackPanel> |
28 | | - <TextBlock Text="Model Type"/> |
29 | | - <ComboBox ItemsSource="{Binding Source={StaticResource ModelType}}" SelectedItem="{Binding ModelType}" /> |
30 | | - <StackPanel.Style> |
31 | | - <Style TargetType="{x:Type StackPanel}"> |
32 | | - <Setter Property="IsEnabled" Value="False" /> |
| 23 | + <StackPanel Visibility="{Binding EnableTemplateSelection, Converter={StaticResource BooleanToVisibilityConverter}}"> |
| 24 | + <TextBlock Text="Model Type"/> |
| 25 | + <ComboBox ItemsSource="{Binding ModelTemplates}" SelectedItem="{Binding ModelTemplate}" DisplayMemberPath="Name" > |
| 26 | + <ComboBox.ItemContainerStyle> |
| 27 | + <Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> |
| 28 | + <Setter Property="Visibility" Value="Visible" /> |
33 | 29 | <Style.Triggers> |
34 | | - <DataTrigger Binding="{Binding PipelineType, ElementName=UI}" Value="StableDiffusionXL"> |
35 | | - <Setter Property="IsEnabled" Value="True" /> |
| 30 | + <DataTrigger Binding="{Binding Category}" Value="Upscaler"> |
| 31 | + <Setter Property="Visibility" Value="Collapsed"/> |
36 | 32 | </DataTrigger> |
37 | | - <DataTrigger Binding="{Binding PipelineType, ElementName=UI}" Value="LatentConsistencyXL"> |
38 | | - <Setter Property="IsEnabled" Value="True" /> |
| 33 | + <DataTrigger Binding="{Binding IsUserTemplate}" Value="True"> |
| 34 | + <Setter Property="Visibility" Value="Collapsed"/> |
39 | 35 | </DataTrigger> |
40 | 36 | </Style.Triggers> |
41 | | - </Style> |
42 | | - </StackPanel.Style> |
43 | | - </StackPanel> |
44 | | - </UniformGrid> |
45 | 37 |
|
46 | | - |
| 38 | + </Style> |
| 39 | + </ComboBox.ItemContainerStyle> |
| 40 | + </ComboBox> |
| 41 | + </StackPanel> |
47 | 42 |
|
48 | | - |
49 | 43 |
|
50 | 44 | <StackPanel Margin="0,10,0,0"> |
51 | 45 | <TextBlock Text="Model Folder"/> |
52 | 46 | <userControls:FilePickerTextBox FileName="{Binding ModelFolder, Mode=TwoWay}" IsFolderPicker="True" /> |
53 | 47 | </StackPanel> |
54 | 48 |
|
55 | | - <StackPanel Margin="0,10,0,0"> |
| 49 | + <StackPanel Margin="0,10,0,0" Visibility="{Binding EnableNameSelection, Converter={StaticResource BooleanToVisibilityConverter}}"> |
56 | 50 | <TextBlock Text="Model Name"/> |
57 | 51 | <TextBox Text="{Binding ModelName, UpdateSourceTrigger=PropertyChanged}" /> |
58 | 52 | </StackPanel> |
59 | 53 |
|
60 | 54 | <StackPanel Margin="5"> |
61 | | - <StackPanel Orientation="Horizontal" Visibility="{Binding IsNameInvalid, Converter={StaticResource BooleanToVisibilityConverter}}"> |
62 | | - <userControls:FontAwesome Icon="" Color="Red" /> |
63 | | - <TextBlock Text="Name" Margin="5,0,0,3" /> |
64 | | - </StackPanel> |
| 55 | + |
65 | 56 |
|
66 | 57 | <ItemsControl ItemsSource="{Binding ValidationResults}"> |
67 | 58 | <ItemsControl.ItemTemplate> |
68 | | - <DataTemplate DataType="{x:Type local:ValidationResult}"> |
| 59 | + <DataTemplate DataType="{x:Type models:ValidationResult}"> |
69 | 60 | <StackPanel Orientation="Horizontal"> |
70 | 61 | <userControls:FontAwesome > |
71 | 62 | <userControls:FontAwesome.Style> |
|
81 | 72 | </Style> |
82 | 73 | </userControls:FontAwesome.Style> |
83 | 74 | </userControls:FontAwesome> |
84 | | - <TextBlock Text="{Binding ModelType}" Margin="5,0,0,3" /> |
| 75 | + <TextBlock Text="{Binding Name}" Margin="5,0,0,3" /> |
85 | 76 | </StackPanel> |
86 | 77 | </DataTemplate> |
87 | 78 | </ItemsControl.ItemTemplate> |
|
93 | 84 | </StackPanel> |
94 | 85 | <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,0,0"> |
95 | 86 | <UniformGrid Columns="2" Height="30"> |
96 | | - <Button Content="Ok" Command="{Binding SaveCommand}" IsDefault="True"/> |
| 87 | + <Button Content="Save" Command="{Binding SaveCommand}" IsDefault="True"/> |
97 | 88 | <Button Content="Cancel" Command="{Binding CancelCommand}" Width="100"/> |
98 | 89 | </UniformGrid> |
99 | 90 | </StackPanel> |
|
0 commit comments