I have a class called Loader and inside Loader I have:
public class Loader
{
public static UIElement Background { get; private set; }
// ...
public void LoadFile(FileInfo file)
{
// ...
}
}
What this class does, is load a file, either a XAML, MP4, WMV, JPG, or PNG file. The LoadFile() function will take the file and create an object out of it to be placed on the main form. Now the problem is, how do I display this Background object dynamically in my XAML?
Things I've tried:
1)
<!-- Namespace for the Loader class here -->
<x:Static Member="loader:Loader.Background" />
This works, but the object never changes when I call LoadFile() again with a different file, it stays static (hence the x:Static?).
2) I tried adding the Background object to a VisualBrush's Visual property, and using that visual brush as a background for a grid. This worked and loads everything the way I want, but animations in the XAML file do not run.
There's got to be something I'm missing here...