Skip to content

Unable to create multithread UI #594

@LHTXQ

Description

@LHTXQ

Describe the bug

I want to creat windows on new thread but get an error in window construct method(Can't access between each process can freeze "System. Windows. Media. SolidColorBrush", because can't freeze it).

I think the solution to this problem should be to make all Brush freezable.

To Reproduce

Creat new window as:

var thread = new Thread(()=>
ToolKitWindow = new():
ToolKitWindow. Closed += delegate
{
Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal):
};
ToolKitWindow. Dispatcher. Invoke(()=>
{
ToolKitWindow.Show():
Dispatcher. Run();
});
thread.SetApartmentState (ApartmentState. STA):
thread. Start();

Expected behavior

Creat success.

Screenshots

No response

OS version

11

.NET version

6

WPF-UI NuGet version

2.0.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions