|
| 1 | +<Window x:Class="WpfMVVMSample.MainWindow" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 5 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 6 | + xmlns:prism="http://prismlibrary.com/" |
| 7 | + xmlns:conv="clr-namespace:WpfMVVMSample.Converters" |
| 8 | + xmlns:local="clr-namespace:WpfMVVMSample" |
| 9 | + xmlns:units="clr-namespace:UnitsNet.Units;assembly=UnitsNet" |
| 10 | + prism:ViewModelLocator.AutoWireViewModel="True" |
| 11 | + |
| 12 | + mc:Ignorable="d" |
| 13 | + Title="MainWindow"> |
| 14 | + <Window.Resources> |
| 15 | + <Style TargetType="TextBox"> |
| 16 | + <Setter Property="HorizontalAlignment" Value="Stretch"/> |
| 17 | + <Setter Property="HorizontalContentAlignment" Value="Center"/> |
| 18 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 19 | + <Setter Property="Height" Value="30"/> |
| 20 | + <Setter Property="FontSize" Value="16"/> |
| 21 | + <Setter Property="Margin" Value="10"/> |
| 22 | + </Style> |
| 23 | + <Style TargetType="ComboBox"> |
| 24 | + <Setter Property="HorizontalAlignment" Value="Stretch"/> |
| 25 | + <Setter Property="HorizontalContentAlignment" Value="Center"/> |
| 26 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 27 | + <Setter Property="Height" Value="30"/> |
| 28 | + <Setter Property="FontSize" Value="16"/> |
| 29 | + <Setter Property="Margin" Value="10"/> |
| 30 | + </Style> |
| 31 | + <Style TargetType="Label" x:Key="ResultLabel"> |
| 32 | + <Setter Property="HorizontalAlignment" Value="Center"/> |
| 33 | + <Setter Property="HorizontalContentAlignment" Value="Center"/> |
| 34 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 35 | + <Setter Property="Height" Value="30"/> |
| 36 | + <Setter Property="FontSize" Value="16"/> |
| 37 | + <Setter Property="Width" Value="150"/> |
| 38 | + <Setter Property="Margin" Value="10"/> |
| 39 | + </Style> |
| 40 | + <Style TargetType="Label"> |
| 41 | + <Setter Property="HorizontalAlignment" Value="Right"/> |
| 42 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 43 | + <Setter Property="Margin" Value="10,0"/> |
| 44 | + <Setter Property="FontSize" Value="16"/> |
| 45 | + </Style> |
| 46 | + </Window.Resources> |
| 47 | + <StackPanel> |
| 48 | + <Expander Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3" FontSize="16" Background="WhiteSmoke"> |
| 49 | + <Expander.Header> |
| 50 | + <Border> |
| 51 | + <Label Content="Settings"></Label> |
| 52 | + </Border> |
| 53 | + </Expander.Header> |
| 54 | + <Grid> |
| 55 | + <Grid.ColumnDefinitions> |
| 56 | + <ColumnDefinition Width="1*"/> |
| 57 | + <ColumnDefinition Width="2*"/> |
| 58 | + <ColumnDefinition Width="1*"/> |
| 59 | + </Grid.ColumnDefinitions> |
| 60 | + <Grid.RowDefinitions> |
| 61 | + <RowDefinition Height="Auto"/> |
| 62 | + <RowDefinition Height="Auto"/> |
| 63 | + <RowDefinition Height="Auto"/> |
| 64 | + <RowDefinition Height="Auto"/> |
| 65 | + <RowDefinition Height="Auto"/> |
| 66 | + </Grid.RowDefinitions> |
| 67 | + |
| 68 | + <Label Grid.Column="0" Grid.Row="0" Content="Mass"/> |
| 69 | + <ComboBox Grid.Column="1" |
| 70 | + ItemsSource="{Binding Source={conv:EnumBindingSource {x:Type units:MassUnit}}}" |
| 71 | + SelectedItem="{Binding Settings.DefaultMassUnit}"/> |
| 72 | + |
| 73 | + <Label Grid.Column="0" Grid.Row="1" Content="G" /> |
| 74 | + <ComboBox Grid.Column="1" Grid.Row="1" |
| 75 | + ItemsSource="{Binding Source={conv:EnumBindingSource {x:Type units:AccelerationUnit}}}" |
| 76 | + SelectedItem="{Binding Settings.DefaultAccelerationUnit}"/> |
| 77 | + |
| 78 | + <Label Grid.Column="0" Grid.Row="2" Content="Weight" /> |
| 79 | + <ComboBox Grid.Column="1" Grid.Row="2" |
| 80 | + ItemsSource="{Binding Source={conv:EnumBindingSource {x:Type units:ForceUnit}}}" |
| 81 | + SelectedItem="{Binding Settings.DefaultForceUnit}"/> |
| 82 | + |
| 83 | + <Label Grid.Column="0" Grid.Row="3" Content="No. Digits" /> |
| 84 | + <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Settings.SignificantDigits}"/> |
| 85 | + </Grid> |
| 86 | + </Expander> |
| 87 | + <Grid> |
| 88 | + <Grid.ColumnDefinitions> |
| 89 | + <ColumnDefinition Width="1*"/> |
| 90 | + <ColumnDefinition Width="2*"/> |
| 91 | + <ColumnDefinition Width="1*"/> |
| 92 | + </Grid.ColumnDefinitions> |
| 93 | + <Grid.RowDefinitions> |
| 94 | + <RowDefinition Height="Auto"/> |
| 95 | + <RowDefinition Height="Auto"/> |
| 96 | + <RowDefinition Height="Auto"/> |
| 97 | + <RowDefinition Height="Auto"/> |
| 98 | + </Grid.RowDefinitions> |
| 99 | + |
| 100 | + <Label Grid.Column="0" Grid.Row="0" Content="Mass"/> |
| 101 | + <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding ObjectMass, Converter={conv:UnitToStringConverter}}"/> |
| 102 | + |
| 103 | + <Label Grid.Column="0" Grid.Row="1" Content="G" /> |
| 104 | + <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding G, Converter={conv:UnitToStringConverter}}"/> |
| 105 | + |
| 106 | + <Label Grid.Column="0" Grid.Row="2" Content="Weight" /> |
| 107 | + <Label Grid.Column="1" Grid.Row="2" Content="{Binding Weight, Converter={conv:UnitToStringConverter}}" Style="{StaticResource ResultLabel}"/> |
| 108 | + |
| 109 | + </Grid> |
| 110 | + </StackPanel> |
| 111 | +</Window> |
0 commit comments