Window becomes inactive after DialogHost.Show()
Les mainteneurs répondent en général sous 1 jour
@MichelMichels y travaille déjà.
Depuis le 31/3/2024.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Bug explanation
I'm trying to make a preloader using DialogHost (I need to display a loading indicator and lock the application while the data is being loaded)
However, when I call DialogHost.Show(), the application window loses focus
5.0.1-ci571:
if you click on a dialog, the window will become active again along with the dialog.
so they are not mutually exclusive
In my past project I used version 4.6.1 and the window did not lose focus when DialogHost was opened
I tried different versions in the current project:
- 4.10.0-ci317 everything works perfectly
- 5.0.0-ci321 this bug appears
4.10.0-ci317:
How can this be fixed without downgrading to an older version?
My code:
PreloaderDialog
<UserControl x:Class="Client.View.Dialogs.PreloaderDialog"
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"
mc:Ignorable="d">
<ProgressBar Width="24"
Height="24"
Margin="16"
IsIndeterminate="True"
Style="{StaticResource MaterialDesignCircularProgressBar}"
Value="33" />
</UserControl>
MainWindow
<Window x:Class="Client.View.Windows.MainWindow"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:controls="clr-namespace:Client.View.Controls"
mc:Ignorable="d"
Title="FriendSync"
Height="500" Width="540"
WindowStartupLocation="CenterScreen">
<materialDesign:DialogHost
Identifier="RootDialog"
DialogTheme="Inherit"
Loaded="DialogHost_OnInitialized">
...
</materialDesign:DialogHost>
</Window>
Method to show preloader
public static async Task DoWithPreloader(Action action, string host = DIALOG_ROOT) {
var dialog = new PreloaderDialog();
if (DialogHost.IsDialogOpen(host)) {
try {
DialogHost.Close(host);
} catch (Exception) {
// ignored
}
}
await DialogHost.Show(dialog, host, new DialogOpenedEventHandler((_, args) => {
action();
try {
if (!args.Session.IsEnded) {
args.Session.Close(false);
}
} catch (Exception) {
// ignored
}
}));
}
Calling code
DialogUtils.DoWithPreloader(() => {
// some time-consuming code
});
Version
5.0.1-ci571
- Langage dominant
- C#
- Étoiles
- 16.3k
- Forks
- 3.5k
- Merge moyen
- 4 h 25 min
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de MaterialDesignInXAML/MaterialDesignInXamlToolkit
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4124 ·
Les mainteneurs répondent en général sous 1 jour
-
MaterialDesignChoiceChipListBoxItem missing 'Path=Name' in GroupName binding causes selection conflict between ListBoxesPeut-être pris @corvinsz l’a pris il y a 12 jours. Ouvertebug evaluation required
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4118 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement up-for-grabs
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#2485 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement evaluation required
Difficulté 3/5 Une demi-journée Accessibilité débutants 30/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4120 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Add Semantic, Theme-Aware ColorsPeut-être pris @corvinsz l’a pris il y a 22 jours. Ouverteenhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4114 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de MaterialDesignInXAML/MaterialDesignInXamlToolkit
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
a-corriger documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
christian-raj/S-Aloha#312 ·
-
ready-for-agent tech-debt
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
DigiBanks99/menlo#640 ·
Les mainteneurs répondent en général sous 1 jour
-
ci
Difficulté 1/5 Moins d'une heure Accessibilité débutants 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
Les mainteneurs répondent en général sous 3 jours