Hello,
i was in correspondence with Martin Ivanov and we worked out some information i want to share.
Situation: Multi-Monitor-Environment with Taskbars on every monitor. Docking with floating panes and taskbar icon like: https://github.com/telerik/xaml-sdk/tree/master/Docking/FloatingPaneTaskbarIcons
Problem: when moving a ToolWindow to the next monitor the taskbar icon stays on the monitor it was created.
Reason: some native WPF window behavior
Workaround: Create a custom ToolWindow and "refresh" icon when window is moved to an other monitor:
public
class
CustomToolWindow : ToolWindow
{
private
Screen _startMonitor;
public
CustomToolWindow()
{
LayoutChangeEnded += Window_LayoutChangeEnded;
LayoutChangeStarted += Window_LayoutChangeStarted;
}
private
Screen FindMonitor()
{
var yCenter = Top + (Height / 2);
var xCenter = Left + (Width / 2);
return
Screen.AllScreens.FirstOrDefault(x =>
x.Bounds.Top < yCenter && (x.Bounds.Top + x.Bounds.Height > yCenter)
&& x.Bounds.Left < xCenter && (x.Bounds.Left + x.Bounds.Width > xCenter)
);
}
private
void
Window_LayoutChangeStarted(
object
sender, EventArgs e)
{
_startMonitor = FindMonitor();
}
private
void
Window_LayoutChangeEnded(
object
sender, EventArgs e)
{
if
(!Equals(_startMonitor, FindMonitor()))
{
RadWindowInteropHelper.SetShowInTaskbar(sender
as
ToolWindow,
false
);
RadWindowInteropHelper.SetShowInTaskbar(sender
as
ToolWindow,
true
);
}
}
}
I hope this helps. If someone optimize the code and find a solution to prevent the flickering on "refresh" please share it!
regards marco