Exemplo n.º 1
0
        public void OnPropertyChanged(object source, PropertyChangedEventArgs args)
        {
            if (objectsToNotify != null && OnPropertyChangedAction != null)
            {
                if (BindingDefinition.MustNotify(DataSource, source, args))
                {
                    OnPropertyChangedAction(this, OnPropertyChangedActionArgs);
                }
            }

            if (button != null && EnableProperty != null && args.PropertyName.Equals(excelBindingDefinitionButton.EnablePropertyInfo.Name))
            {
                if (EnablePropertyGet.IsStatic)
                {
                    button.Enable = (bool)EnablePropertyGet.Invoke(null, null);
                }
                else
                {
                    button.Enable = (bool)EnablePropertyGet.Invoke(source, null);
                }
            }
        }
Exemplo n.º 2
0
        public void CreateControl(ExcelInterop.Range range)
        {
            ExcelBindingDefinitionButton definition = (ExcelBindingDefinitionButton)BindingDefinition;

            button = new ExcelButton(range, definition.Definition);
            //bool isStatic = definition.Command == null ? false : definition.Command.IsStatic;
            button.SetCommand(definition.Command, ParentElement.DataSource, definition.OnClickWithRange);

            ResolveBinding();

            if (EnableProperty != null)
            {
                if (EnablePropertyGet.IsStatic)
                {
                    button.Enable = (bool)EnablePropertyGet.Invoke(null, null);
                }
                else
                {
                    button.Enable = (bool)EnablePropertyGet.Invoke(ParentElement.DataSource, null);
                }
            }
        }