Note that there are some explanatory texts on larger screens.

plurals
  1. POModule not rendering
    text
    copied!<p>In my application i'm trying to load the main module trough code. Everything works up to the point of rendering and i have NO clue why it isn't rendering. The content has the right values and everything.. My guess is that something went wibbly wobbly and I seem to be missing it.</p> <p>Control that holds the view</p> <pre><code>[ContentPropertyAttribute("ContentView")] public class ContentControlExtened : ContentControl { public static readonly DependencyProperty ContentProperty = DependencyProperty.Register( "Type", typeof(Type), typeof(ContentControl), new FrameworkPropertyMetadata(null, ContentTypeChanged)); public static readonly DependencyProperty ContentViewProperty = DependencyProperty.Register( "View", typeof(FrameworkElement), typeof(ContentControl), new FrameworkPropertyMetadata(null, ContentViewChanged)); private static void ContentViewChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //throw new NotImplementedException(); } public ContentControlExtened() { this.Loaded += ContentControlLoaded; } private void ContentControlLoaded(object sender, RoutedEventArgs e) { this.LoadContent(); } private void LoadContent() { UserControl u = null; if (Type != null) { u = (UserControl)ServiceLocator.Current.GetInstance(this.Type); } u.Background = new SolidColorBrush(Color.FromRgb(0, 0, 255)); this.View = u; } public Type Type { get { return (Type)GetValue(ContentProperty); } set { SetValue(ContentProperty, value); } } public FrameworkElement View { get { return (FrameworkElement)GetValue(ContentProperty); } set { SetValue(ContentProperty, value); } } } </code></pre> <p>Method in shell to load the main view of the given moduleInfo</p> <pre><code> private void OpenMainView(ModuleInfo module) { Type moduleType = Type.GetType(module.ModuleType); var moduleMainViewType = moduleType.Assembly.GetType(moduleType.Namespace + ".Views.MainView"); this.ContentHolder.MainContent.Type = moduleMainViewType; } </code></pre> <p>The contructor of the mainview is straight forward. Just standard control InitializeComponent() and Datacontext is being set trough the servicelocator.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload