-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProperty.xaml
58 lines (58 loc) · 4.66 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
47
48
49
50
51
52
53
54
55
56
57
58
<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:dashstudio="clr-namespace:SimHub.Plugins.OutputPlugins.Dash.WPFUI;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 NameTextBoxValue}" BorderBrush="{Binding BorderBrush}" 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">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left">
<styles:SHButtonSecondary x:Name="btnAddBind" HorizontalAlignment="Left" Click="btnAddBind_Click" ToolTip="A normal Bind. You can either assign a Button, or just use a Cycler/Toggle to activate this, or both" Content="New Bind" VerticalAlignment="Center"/>
<styles:SHButtonSecondary x:Name="btnAddCyclerBind" HorizontalAlignment="Left" Click="btnAddCyclerBind_Click" ToolTip="Cycles either Forwards or Backwards through all normal binds" Content="New Cycler Bind" VerticalAlignment="Center"/>
<styles:SHButtonSecondary x:Name="btnAddToggleBind" HorizontalAlignment="Left" Click="btnAddToggleBind_Click" ToolTip="Press the assigned Button to activate, a further press will return the value to the previously active Bind" Content="New Toggle Bind" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,5,0">
<Label HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,5,0" Content="Value Lock"/>
<CheckBox IsChecked="{Binding CanBeDisabled}" ToolTip="Allow value modification only when attached SimHub property is true." HorizontalAlignment="Left" Margin="0,0,5,0" Click="chkboxEnableProperty_Click" VerticalAlignment="Center"/>
<dashstudio:FormulaPicker Expression="{Binding EnabledProperty}" IsEnabled="{Binding CanBeDisabled}" HorizontalAlignment="Left" VerticalAlignment="Center"></dashstudio:FormulaPicker>
</StackPanel>
</Grid>
<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>