mask entry dialog has a drop-down list of possible extensions.

This commit is contained in:
morkt 2015-08-11 07:10:17 +04:00
parent 2f2bbb3dc0
commit f8fcf9fb21
2 changed files with 11 additions and 5 deletions

View File

@ -8,7 +8,7 @@
WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="{x:Static s:guiStrings.LabelEnterMask}"/>
<TextBox Name="Mask"/>
<ComboBox Loaded="Mask_Loaded" Name="Mask" IsEditable="True"/>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Button Width="75" Height="25" Content="{x:Static s:guiStrings.ButtonOK}" IsDefault="True" Margin="0,0,10,0" Click="Button_Click"/>
<Button Width="75" Height="25" Content="{x:Static s:guiStrings.ButtonCancel}" IsCancel="True"/>

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace GARbro.GUI
@ -12,16 +13,21 @@ namespace GARbro.GUI
public EnterMaskDialog (IEnumerable<string> mask_list)
{
InitializeComponent ();
// Mask.ItemsSource = mask_list;
Mask.ItemsSource = mask_list;
Mask.Text = "*.*";
Mask.SelectionStart = 2;
Mask.SelectionLength = 1;
FocusManager.SetFocusedElement (this, Mask);
}
private void Button_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void Mask_Loaded (object sender, RoutedEventArgs e)
{
var text_box = (TextBox)Mask.Template.FindName ("PART_EditableTextBox", Mask);
FocusManager.SetFocusedElement (this, text_box);
text_box.SelectionStart = 2;
text_box.SelectionLength = 1;
}
}
}