-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProperty.xaml
46 lines (46 loc) · 3.22 KB
/
Property.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
<UserControl x:Name="userControl" x:Class="SwitchableProperties.Property"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SwitchableProperties"
xmlns:ui="clr-namespace:SimHub.Plugins.UI;assembly=SimHub.Plugins"
xmlns:styles="clr-namespace:SimHub.Plugins.Styles;assembly=SimHub.Plugins"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="400">
<UserControl.CommandBindings>
<CommandBinding Command="{x:Static local:Property.DeleteBindCommand}"
Executed="DeleteBind_OnExecuted"/>
</UserControl.CommandBindings>
<styles:SHExpander Visibility="Visible">
<styles:SHExpander.HeaderTemplate>
<DataTemplate>
<Grid>
<TextBox x:Name="txtPropertyName" Text="{Binding PropertyName}" DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Property}}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0" Width="Auto" MinWidth="100"/>
<styles:SHButtonSecondary x:Name="btnDeleteProperty" Command="{x:Static local:SettingsControl.DeletePropertyCommand}" CommandParameter="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Property}}}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0">Delete</styles:SHButtonSecondary>
</Grid>
</DataTemplate>
</styles:SHExpander.HeaderTemplate>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<styles:SHButtonSecondary x:Name="btnAddBind" HorizontalAlignment="Left" Click="btnAddBind_Click">New bind</styles:SHButtonSecondary>
<styles:SHButtonSecondary x:Name="btnAddCyclerBind" HorizontalAlignment="Left" Click="btnAddCyclerBind_Click">New cycler bind</styles:SHButtonSecondary>
<styles:SHButtonSecondary x:Name="btnAddToggleBind" HorizontalAlignment="Left" Click="btnAddToggleBind_Click">New toggle bind</styles:SHButtonSecondary>
</StackPanel>
<ItemsControl x:Name="pnlBinds" ItemsSource="{Binding Binds}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type local:SwitchableValueBind}">
<local:Bind DataContext="{Binding}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:SwitchableCyclerBind}">
<local:CyclerBind DataContext="{Binding}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:SwitchableToggleBind}">
<local:ToggleBind DataContext="{Binding}"/>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</StackPanel>
</styles:SHExpander>
</UserControl>