Problem with Multiple Windows, Multiple Threads when using Ribbon control or ChromelessWindow
Hello
I have an application where I need to run multiple windows on separate threads.
An example of what I need can be seen in an article in the MSDN section "Multiple Windows, Multiple Threads"
When performing my tests I realized that using the ChromelessWindow or Ribbon controls, I lose this possibility. Below is an example of my code example to reproduce the problem.
MainWindow.xaml code:
<Window x:Class="testeTH.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Height="40" Width="200" Click="ButtonBase_OnClick"></Button>
</Grid>
</Window>
MainWindow.xaml.cs Codebehind
public partial class MainWindow : Window
{
public Thread newWindowThread { get; set; }
public MainWindow()
{
InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
execTH();
//test tempWindow = new test();
//tempWindow.Show();
}
private void execTH()
{
newWindowThread= new Thread(new ThreadStart(() =>
{
// Create our context, and install it:
SynchronizationContext.SetSynchronizationContext(
new DispatcherSynchronizationContext(
Dispatcher.CurrentDispatcher));
test tempWindow = new test();
// When the window closes, shut down the dispatcher
tempWindow.Closed += (s, ex) => Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);
tempWindow.Show();
// Start the Dispatcher Processing
System.Windows.Threading.Dispatcher.Run();
}));
// Setup and start thread as before
// Set the apartment state
newWindowThread.SetApartmentState(ApartmentState.STA);
// Make the thread a background thread
newWindowThread.IsBackground = true;
// Start the thread
newWindowThread.Start();
}
}
test.xaml - the target window to run in a separate thread
<syncfusion:ChromelessWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="testeTH.test"
Title="test" Height="300" Width="300" >
<DockPanel>
<syncfusion:Ribbon x:Name="rb" DockPanel.Dock="Top">
</syncfusion:Ribbon>
</DockPanel>
</syncfusion:ChromelessWindow>
test.xaml.cs codebehind
public partial class test
{
public test()
{
InitializeComponent();
}
}
Just the fact call the window with the Ribbon control added to the target window has a xaml parse error.If I remove the Ribbon control and keep the window Chromeless can only run it just 1 time, even prompting his Dispacther the method BeginInvokeShutdown.
If I change the ChromelessWindow Window for easy and not put the Ribbon control, I can run the window in a separate thread.
How can I solve this by using these controls? Mostly. How to successfully call a window in a separate thread added the Ribbon control?
Att Angelo Antonio Xavier Hulek
4sec Brazil.
The solution example is attached for research.
The version of syncfusion wpf Essential Studio controls is 11.4.0.26
Attachment: testeTH_50aff661.rar
SIGN IN To post a reply.
1 Reply
MA
Muthukumar A
Syncfusion Team
May 19, 2014 10:16 AM UTC
Hi Herbert Moroni,
We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates
Please let me know if you have any questions.
Regards,
Muthukumar A
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
HM Herbert Moroni Cavallari de Costa Gois
- May 14, 2014 12:43 PM UTC
- May 19, 2014 10:16 AM UTC