/// <summary> /// Delegate called when the background brush changed. /// </summary> /// <param name="pObject">The modified control.</param> /// <param name="pEventArgs">The event arguments.</param> private static void OnBackgroundChanged(DependencyObject pObject, DependencyPropertyChangedEventArgs pEventArgs) { ConnectorsPresenter lContainer = pObject as ConnectorsPresenter; if (lContainer != null) { lContainer.UpdateConnectorsBackground(); } }
/// <summary> /// Method called when the control template is applied. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // Getting the parts of the control. this.mConnectorsPresenter = this.GetTemplateChild(PART_CONNECTORS_PRESENTER) as ConnectorsPresenter; if (this.mConnectorsPresenter == null) { throw new Exception("PortView control template not correctly defined."); } // The content of the PortView is the PortViewModel. Binding lPositionBinding = new Binding("Position"); lPositionBinding.Source = this.Content; lPositionBinding.Mode = BindingMode.OneWayToSource; this.Connector.SetBinding(AConnector.PositionProperty, lPositionBinding); }