Reputation: 38335
Using the IWindowManager of Caliburn.Micro, is it possible to create a borderless window using the ShowWindow
method?
In this case, the content of the Window is generated from a UserControl. And Caliburn.Micro will create a Window to host the UserControl.
Upvotes: 3
Views: 3427
Reputation: 139758
EDIT: The status today:
With the current Caliburn.Micro v1.2 (July 20, 2011) release it's not possible to set properties on the created window. You can inherit from the WindowManager
and override the CreateWindow
method:
public class BorderlessWindowManager : WindowManager
{
protected override Window CreateWindow(object rootModel, bool isDialog,
object context)
{
var window = base.CreateWindow(rootModel, isDialog, context);
window.WindowStyle = WindowStyle.None;
window.ShowInTaskbar = false;
window.AllowsTransparency = true;
window.Background = new SolidColorBrush(Colors.Transparent);
return window;
}
}
When the new version released:
Yes it's possible, with the settings
parameter:
public interface IWindowManager
{
//...
void ShowWindow(object rootModel, object context = null,
IDictionary<string, object> settings = null);
}
Caliburn.Micro will use this dictionary as [property name; property value]
bag and set them on the created window with reflection.
I've never created a borderless window but based on this artice something like this should work:
windowManger.ShowWindow(viewModel,
settings: new Dictionary<string, object>
{
{ "WindowStyle", WindowStyle.None},
{ "ShowInTaskbar", false},
{ "AllowsTransparency", true},
{ "Background", new SolidColorBrush(Colors.Transparent)},
});
Upvotes: 8