Пример #1
0
        private RadMenuItem CreateRadMenuItem(string header, bool isCheckable, RadRoutedEventHandler clickAction, object tag = null,
                                              Action <RadMenuItem> extraAction = null, string command = null)
        {
            var item = new RadMenuItem
            {
                Header      = header,
                IsCheckable = isCheckable,
                Tag         = tag
            };

            if (!string.IsNullOrEmpty(command))
            {
                var commandBinding = new Binding(command)
                {
                    Source = reportGadgetViewModel
                };

                item.SetBinding(RadMenuItem.CommandProperty, commandBinding);
            }

            if (clickAction != null)
            {
                item.Click += clickAction;
            }

            if (TryFindResource("HandGridMenuItemStyle") is Style style)
            {
                item.Style = style;
            }

            extraAction?.Invoke(item);

            return(item);
        }
Пример #2
0
 public DependencyPropertyWatcher(object watchedElement, string propertyName, RadRoutedEventHandler propertyChangedCallback)
 {
     this.watchedElement = watchedElement;
     this.callback       = propertyChangedCallback;
     BindingOperations.SetBinding(this, DependencyPropertyWatcher <T> .WatcherPropertyProperty, new Binding(propertyName)
     {
         Source = watchedElement
     });
 }
Пример #3
0
 public void Dispose()
 {
     this.watchedElement = null;
     this.callback       = null;
 }