mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[TextExtractor] Extend settings with preferred language (#22901)
* [TextExtractor] Extend settings with preferred language * TextExtractor simplifying code, adding update languages on dropdown opening * fix typo * TextExtractor fixing bug with order of languages
This commit is contained in:
@@ -55,6 +55,18 @@
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard
|
||||
x:Uid="TextExtractor_Languages">
|
||||
<ComboBox
|
||||
x:Name="TextExtractor_ComboBox"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
ItemsSource="{x:Bind Path=ViewModel.AvailableLanguages, Mode=OneWay}"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.LanguageIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValue="{Binding SelectedColorRepresentationValue, Mode=TwoWay}"
|
||||
Loaded="TextExtractor_ComboBox_Loaded"
|
||||
DropDownOpened="TextExtractor_ComboBox_DropDownOpened">
|
||||
</ComboBox>
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
@@ -23,5 +23,21 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TextExtractor_ComboBox_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
/**
|
||||
* UWP hack
|
||||
* because UWP load the bound ItemSource of the ComboBox asynchronous,
|
||||
* so after InitializeComponent() the ItemSource is still empty and can't automatically select a entry.
|
||||
* Selection via SelectedItem and SelectedValue is still not working too
|
||||
*/
|
||||
ViewModel.UpdateLanguages();
|
||||
}
|
||||
|
||||
private void TextExtractor_ComboBox_DropDownOpened(object sender, object e)
|
||||
{
|
||||
ViewModel.UpdateLanguages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user