This project is read-only.

BackgroundContent: how does it work?

Aug 29, 2013 at 2:00 PM
Edited Aug 29, 2013 at 2:06 PM
I can't seem to figure out how to set well...anything besides plain text as the window background. Some beginner friendly explanation and sample or some pointers to other resources would help!

What can be assigned to BackgroundContent and how? For instance, given a user control defined in bg.xaml, can it be assigned to BackgroundContent or MainWindow and how? Does it work with a resource?

PS: I figured out how to set a user control as background content from code but is there a way to set it inside the xaml directly?

Here's how I did it from code:
    public partial class MainWindow : ModernWindow
    {
        public MainWindow()
        {
            InitializeComponent();
           TestBGContent bg = new TestBGContent();
            this.BackgroundContent = bg;
        }
    }
Aug 30, 2013 at 3:39 PM
ModernWindow.BackgroundContent is an object that is rendered in a ContentPresenter. It can be anything, but most often is just a visual such as an Image. You can declare background content in your MainWindow.xaml like so:
<mui:ModernWindow .... >
  <mui:ModernWindow.BackgroundContent>
    <Image Source=".." />
  </mui:ModernWindow.BackgroundContent>
</mui:ModernWindow>