<UserControl x:Class="VIZ.Package.Module.TripletEditPanel"
             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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
             xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
             xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
             xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
             xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
             xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
             xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
             xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
             xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
             xmlns:local="clr-namespace:VIZ.Package.Module"
             d:DataContext="{d:DesignInstance Type=local:TripletEditPanelModel}" 
             d:Background="White"
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="800">
    <UserControl.Resources>
        <fcore:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></fcore:Bool2VisibilityConverter>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" MaxHeight="60"></RowDefinition>
            <RowDefinition Height="*" MaxHeight="60"></RowDefinition>
            <RowDefinition Height="*" MaxHeight="60"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="60"></ColumnDefinition>
            <ColumnDefinition Width="*" MaxWidth="200"></ColumnDefinition>
            <ColumnDefinition Width="*" MaxWidth="200"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <!-- 值编辑 -->
        <TextBlock Text="X:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Grid.Row="0"></TextBlock>
        <common:LeftRightTextEdit Grid.Row="0" Grid.Column="1" Height="30" 
                                  dxe:NumericMaskOptions.ValueAfterDelete="ZeroThenNull"
                                  dxe:NumericMaskOptions.HideInsignificantZeros="True"
                                  dxe:NumericMaskOptions.AlwaysShowDecimalSeparator="False"
                                  MaskType="Numeric"
                                  EditValue="{Binding Path=X,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></common:LeftRightTextEdit>
        <TextBlock Text="Y:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Grid.Row="1"></TextBlock>
        <common:LeftRightTextEdit Grid.Row="1" Grid.Column="1" Height="30" 
                                  dxe:NumericMaskOptions.ValueAfterDelete="ZeroThenNull"
                                  dxe:NumericMaskOptions.HideInsignificantZeros="True"
                                  dxe:NumericMaskOptions.AlwaysShowDecimalSeparator="False"
                                  MaskType="Numeric"
                                  EditValue="{Binding Path=Y,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></common:LeftRightTextEdit>
        <TextBlock Text="Z:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Grid.Row="2"></TextBlock>
        <common:LeftRightTextEdit Grid.Row="2" Grid.Column="1" Height="30" 
                                  dxe:NumericMaskOptions.ValueAfterDelete="ZeroThenNull"
                                  dxe:NumericMaskOptions.HideInsignificantZeros="True"
                                  dxe:NumericMaskOptions.AlwaysShowDecimalSeparator="False"
                                  MaskType="Numeric"
                                  EditValue="{Binding Path=Z,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></common:LeftRightTextEdit>

        <!-- 编辑模式 -->
        <RadioButton x:Name="rb_Single" Grid.Row="0" Grid.Column="2" Content="Single" Margin="50,0,0,0"
                     Visibility="{Binding Path=IsEditModeVisible,Converter={StaticResource Bool2VisibilityConverter}}"
                     IsChecked="True">
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=EditModeChangedCommand}"
                                       CommandParameter="{x:Static local:TripletEditPanelMode.Single}"></dxmvvm:EventToCommand>
            </dxmvvm:Interaction.Behaviors>
        </RadioButton>
        <RadioButton Grid.Row="1" Grid.Column="2" Content="Locked" Margin="50,0,0,0"
                     Visibility="{Binding Path=IsEditModeVisible,Converter={StaticResource Bool2VisibilityConverter}}">
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=EditModeChangedCommand}"
                                       CommandParameter="{x:Static local:TripletEditPanelMode.Locked}"></dxmvvm:EventToCommand>
            </dxmvvm:Interaction.Behaviors>
        </RadioButton>
        <RadioButton Grid.Row="2" Grid.Column="2" Content="Propotional" Margin="50,0,0,0"
                     Visibility="{Binding Path=IsEditModeVisible,Converter={StaticResource Bool2VisibilityConverter}}">
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=EditModeChangedCommand}"
                                       CommandParameter="{x:Static local:TripletEditPanelMode.Propotional}"></dxmvvm:EventToCommand>
            </dxmvvm:Interaction.Behaviors>
        </RadioButton>
    </Grid>
</UserControl>
