c# - WPF UserControl.Loaded event does not trigger -


my program when I (mouseenter event) a TransportOrderLineDetailView to hover over a certain UserControl (Here I use TransportOrderLineUserControl) Should be shown.

The TransportOrderLineDetailView should be placed at the bottom right of my screen. For this I want to see the actual Wide & amp; The actual highlight for the actual placement is because those 2 properties require a different value than 0, because I execute this code with the DetailView.Loaded event.

I use the exact same type for two other items I do not work for TransportOrderLineDetailView

Code where the scene is generated:.

  TransportOrderLineDetailView tolDetailView = new TransportOrderLineDetailView (New TransportOrderLineDetailViewModel (transportOrderLine)); Window.DetailContent = tolView; TolView.Loaded + = SetDetailViewOnUI;  

code-behind view:

  public TransportOrderLineDetailView (TransportOrderLineDetailViewModel detailViewModel) {InitializeComponent (); Datacontex = descriptionviewmodel; }  

Method SetDetailViewOnUI:

  private void SetDetailPanelOnUI (object sender, EventArgs e) {Canvas.SetLeft (window.DetailContentPresenter, window.grid_Root.ActualWidth - Window.DetailContentPresenter.ActualWidth); Canvas Settop (Windows Distinct Content Presenter, WindowGrid.Root, RealHight - Window.Destate Content Viewer, RealHight); }  

For example, where it works well:

  DriverDetailView driverDetailView = new DriverDetailView (New DriverDetailViewModel (driver)); Window.DetailContent = driverDetailView; DriverDetailView.Loaded + = SetDetailPanelOnUI;  

More info

  • window.DetailContent:

      Personal UserControl detailContent; Public UserControl detailcontent {get {this.detailContent return; } Set {this.detailContent = value; OnPropertyChanged ("DetailContent"); }}  
  • Expand Editor:

      & lt; Canvas grid. Rowspan = "2" x: name = "canvas_Popup_DetailView" & gt; & Lt; ContentPresenter Content = "{Binding Extension Content}" x: Name = "Expanding Editor" /> & lt; / Canvas & gt;             ; Datacontex = descriptionviewmodel; this. Loaded + = test; // test here} private void test (object sender, System.Windows.RoutedEventArgs e) {// method never executes}  

The solution found was an error that was not thrown.

I found out that this was going to debug in Visual Studio -> Exception -> Possible Exceptions to Tackle

Hope this will help other people to bother with the same stuff. :)


Comments