protected override void OnApplyTemplate() { base.OnApplyTemplate(); //get required parts _mainGrid = GetTemplateChild(MainGridPart) as Grid; if (_mainGrid == null) { throw new NullReferenceException($"{MainGridPart} is missing in the control template"); } //inherit defaultOverlaySize var parent = OverlayItemsControl.GetParent <OverlayItemsControl>(this); if (parent != null && DefaultOverlaySize == null && GetBindingExpression(DefaultOverlaySizeProperty) == null) { SetBinding(DefaultOverlaySizeProperty, new Binding() { Path = new PropertyPath("DefaultOverlaySize"), Source = parent }); } //hide the grid by default - if nothing databound to it _mainGrid.Visibility = Visibility.Collapsed; UpdateOverlays(); }
void OnVisualStateChanged(object sender, OverlayInfoState e) { //update effects if (_presenter == null) { _presenter = OverlayItemsControl.GetParent <OverlayPresenter>(this); } if (_presenter != null) { _presenter.OverlayVisualStateChanged(this, e, Effects); } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); //inherit defaultOverlaySize var parent = OverlayItemsControl.GetParent <OverlayLabel>(this); if (parent != null && OverlayInfo == null && GetBindingExpression(OverlayInfoProperty) == null) { SetBinding(OverlayInfoProperty, new Binding() { Path = new PropertyPath("OverlayInfo"), Source = parent }); } //set initial state var overlayInfo = OverlayInfo; if (overlayInfo != null) { OnVisualStateChanged(overlayInfo, overlayInfo.VisualState); } }