Issue with touch being disabled when having two windows in two different threads (like a splash screen)
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
I found an issue where touch would be disabled.
If you want to create a custom splash screen and creates a new `Thread` for it, and then create the main window in the Main Thread, touch will no longer work.
This same code works fine in .NET Framework.
Project for reproducing the issue can be found here including description: https://github.com/mbendtsen/touch_issue_net_core
Requires a touch enabled device.
```csharp
public partial class App : Application
{
private Thread _splashThread;
protected async override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ShowSplash();
// Simulate long running work.
await Task.Delay(2000);
_splashViewModel.SetInitialized();
var window = new MainWindow()
{
DataContext = new MainWindowViewModel()
};
window.Show();
}
private void ShowSplash()
{
_splashViewModel = new SplashViewModel();
_splashThread = new Thread(() =>
{
new Splash { DataContext = _splashViewModel }.Show();
Dispatcher.Run();
});
_splashThread.SetApartmentState(ApartmentState.STA);
_splashThread.IsBackground = true;
_splashThread.Name = "Splash";
_splashThread.Start();
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.