示例#1
0
        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;
        }
示例#2
0
 public ElementPairAddedEventArgs(object labelElement, object editorElement, object source, BindingInformation bindingInfo)
 {
     this.labelElement = labelElement;
     this.editorElement = editorElement;
     this.source = source;
     this.bindingInfo = bindingInfo;
 }
        protected override sealed void VisitInternal(BindingInformation info, FormResult result, IEnumerable<object> services)
        {
            object service = services.FirstOrDefault();

            if (service != null)
            {
                this.VisitInternal(info, result, service);
            }
        }
示例#4
0
        protected ColumnResult CreateColumnResult(BindingInformation info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            object columnElement = this.CreateColumn(info.SourceType, info.BindingPath, info.RenderMode);

            return new ColumnResult(columnElement);
        }
示例#5
0
        protected FormResult CreateBindingResult(BindingInformation info)
        {
            Type sourceType = info.SourceType;
            string bindingPath = info.BindingPath;
            string rendermode = info.RenderMode;

            object labelElement = this.CreateLabel();
            object editorElement = this.CreateEditor(sourceType, bindingPath, rendermode);

            return new FormResult(labelElement, editorElement);
        }
示例#6
0
 public abstract IResult Add(BindingInformation info);
 protected abstract void VisitInternal(BindingInformation info, FormResult result, object service);