-
Notifications
You must be signed in to change notification settings - Fork 4
/
SettingsWindow.xaml
76 lines (70 loc) · 3.1 KB
/
SettingsWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<Window x:Class="SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:DotNetNuke.Translator.ViewModel"
xmlns:vw="clr-namespace:DotNetNuke.Translator.View"
Title="SettingsWindow" Height="770" Width="800">
<Window.Resources>
<DataTemplate DataType="{x:Type vm:TranslatorSettingsViewModel}">
<vw:TranslatorSettingsView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ProjectSettingsViewModel}">
<vw:ProjectSettingsView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</DataTemplate>
<DataTemplate x:Key="SettingPanelsTemplate">
<TabControl
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding}"
Margin="4"
SelectedItem="{Binding Path=DataContext.SelectedPanel, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
>
<TabControl.ItemContainerStyle>
<Style TargetType="TabItem">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</TabControl.ItemContainerStyle>
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding DisplayName}" />
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
</DataTemplate>
<DataTemplate x:Key="SettingTabItemTemplate">
<TextBlock Text="foo" />
</DataTemplate>
</Window.Resources>
<Grid Background="#eee">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Background="#fff" Margin="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ItemsControl ItemsSource="{Binding SettingPanels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Margin="8" Padding="10,2"
Command="{Binding Path=DataContext.SelectTabCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
CommandParameter="{Binding}">
<TextBlock Text="{Binding DisplayName}" />
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<ContentControl Grid.Column="1" Background="#fff" Margin="4"
Content="{Binding Path=SettingPanels}"
ContentTemplate="{StaticResource SettingPanelsTemplate}"
/>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1">
<Button Content="Cancel" Margin="6" Command="{Binding CancelCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Padding="10,2" />
<Button Content="OK" Margin="6" Command="{Binding OkCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Padding="10,2" />
</StackPanel>
</Grid>
</Window>