Forráskód Böngészése

Fix ConfirmationPopup localization

CPKreuz 2 éve
szülő
commit
579bbf572c

+ 11 - 8
src/PixiEditor/Views/Dialogs/ConfirmationPopup.xaml

@@ -14,7 +14,8 @@
         Name="popup" WindowStartupLocation="CenterScreen" 
         Height="180" Width="400" MinHeight="180" MinWidth="400"
         WindowStyle="None"
-        FlowDirection="{helpers:Localization FlowDirection}">
+        FlowDirection="{helpers:Localization FlowDirection}"
+        d:DataContext="{d:DesignInstance dial:ConfirmationPopup}">
 
     <WindowChrome.WindowChrome>
         <WindowChrome CaptionHeight="32"  GlassFrameThickness="0.1"
@@ -29,27 +30,29 @@
         <dial:DialogTitleBar DockPanel.Dock="Top"
             TitleText="{Binding ElementName=popup, Path=Title}" CloseCommand="{Binding DataContext.CancelCommand, ElementName=popup}" />
 
-        <StackPanel DockPanel.Dock="Bottom" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center"
+        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center"
                     Margin="0,0,10,15">
-            <Button Margin="10,0,10,0" MinWidth="70" IsDefault="True" Padding="5 0"
+            <Button Margin="10,0,10,0" IsDefault="True" Padding="5 0"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
-                    Style="{StaticResource DarkRoundButton}" Content="{Binding Path=DataContext.FirstOptionText}">
+                    views:Translator.LocalizedString="{Binding FirstOptionText}"
+                    Style="{StaticResource DarkRoundButton}">
                 <Button.CommandParameter>
                     <system:Boolean>True</system:Boolean>
                 </Button.CommandParameter>
             </Button>
-            <Button MinWidth="70" Padding="5 0"
+            <Button Padding="5 0"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
-                    Style="{StaticResource DarkRoundButton}" Content="{Binding Path=DataContext.SecondOptionText}">
+                    views:Translator.LocalizedString="{Binding SecondOptionText}"
+                    Style="{StaticResource DarkRoundButton}">
                 <Button.CommandParameter>
                     <system:Boolean>False</system:Boolean>
                 </Button.CommandParameter>
             </Button>
-            <Button Margin="10,0,10,0" Width="70" Style="{StaticResource DarkRoundButton}" views:Translator.Key="CANCEL"
+            <Button Margin="10,0,10,0" Style="{StaticResource DarkRoundButton}" views:Translator.Key="CANCEL"
                     Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
         </StackPanel>
 
-        <TextBlock Grid.Row="1" 
+        <TextBlock
                    Text="{Binding Body, ElementName=popup}" 
                    HorizontalAlignment="Center" Margin="20,0" 
                    TextWrapping="WrapWithOverflow" 

+ 6 - 6
src/PixiEditor/Views/Dialogs/ConfirmationPopup.xaml.cs

@@ -17,20 +17,20 @@ internal partial class ConfirmationPopup : Window
         DependencyProperty.Register(nameof(Body), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(""));
 
     public static readonly DependencyProperty FirstOptionTextProperty = DependencyProperty.Register(
-        nameof(FirstOptionText), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("YES").Value));
+        nameof(FirstOptionText), typeof(LocalizedString), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("YES")));
 
-    public string FirstOptionText
+    public LocalizedString FirstOptionText
     {
-        get { return (string)GetValue(FirstOptionTextProperty); }
+        get { return (LocalizedString)GetValue(FirstOptionTextProperty); }
         set { SetValue(FirstOptionTextProperty, value); }
     }
 
     public static readonly DependencyProperty SecondOptionTextProperty = DependencyProperty.Register(
-        nameof(SecondOptionText), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("NO").Value));
+        nameof(SecondOptionText), typeof(LocalizedString), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("NO")));
 
-    public string SecondOptionText
+    public LocalizedString SecondOptionText
     {
-        get { return (string)GetValue(SecondOptionTextProperty); }
+        get { return (LocalizedString)GetValue(SecondOptionTextProperty); }
         set { SetValue(SecondOptionTextProperty, value); }
     }