protected override void VisitInternal(BindingInformation info, FormResult result, object service) { IEditableService typedService = (IEditableService)service; FrameworkElement element = (FrameworkElement)result.EditorElement; string editablePropertyName = PropertyUtil<IEditableService>.GetPropertyName(s => s.Editable); string reasonPropertyName = PropertyUtil<IEditableService>.GetPropertyName(s => s.DisabledReason); Binding enabledBinding = new Binding(editablePropertyName); enabledBinding.Source = service; element.SetBinding(UIElement.IsEnabledProperty, enabledBinding); Binding tooltipVisibleBinding = new Binding(editablePropertyName); tooltipVisibleBinding.Source = service; tooltipVisibleBinding.Converter = new CustomBooleanToVisibilityConverter(true); Binding tooltipTextBinding = new Binding(reasonPropertyName); tooltipTextBinding.Source = service; ToolTip tooltip = new ToolTip(); tooltip.SetBinding(UIElement.VisibilityProperty, tooltipVisibleBinding); tooltip.SetBinding(ContentControl.ContentProperty, tooltipTextBinding); element.ToolTip = tooltip; }
protected override sealed void VisitInternal(BindingInformation info, FormResult result, IEnumerable<object> services) { object service = services.FirstOrDefault(); if (service != null) { this.VisitInternal(info, result, service); } }
protected abstract void VisitInternal(BindingInformation info, FormResult result, object service);