コード例 #1
0
    private static void PropertyItemOnMouseEnter(object sender, MouseEventArgs e, PropertyResolverEx resolverEx)
    {
        var propertyItem = (PropertyItem)sender;

        resolverEx.PropertyGrid.HoveredItem = propertyItem;
        if (propertyItem.ToolTip is ToolTip tooltip)
        {
            tooltip.IsOpen = true;
        }
    }
コード例 #2
0
    private static void PropertyItemLoaded(object?sender, EventArgs e, PropertyResolverEx resolverEx, bool hasDescription)
    {
        var propertyItem = (PropertyItem)sender !;

        // Make the child textbox not use built-in tooltip
        var textbox = FindChild <TextBox>(propertyItem, "");

        if (textbox != null)
        {
            textbox.ToolTip   = null;
            textbox.Focusable = false;
        }

        // Make the parent expander non-focusable for controllers.
        var expander = WpfUtilities.FindParent <Expander>(propertyItem);

        if (expander != null)
        {
            expander.Focusable = false;
        }

        if (!hasDescription)
        {
            return;
        }

        var tooltip = new ToolTip();

        tooltip.DataContext     = propertyItem;
        tooltip.Content         = propertyItem.Description;
        tooltip.PlacementTarget = propertyItem;
        tooltip.SetResourceReference(FrameworkElement.StyleProperty, "PropertyGridTooltip");
        ToolTipService.SetInitialShowDelay(tooltip, 0);
        ToolTipService.SetBetweenShowDelay(tooltip, 0);
        propertyItem.ToolTip     = tooltip;
        propertyItem.MouseEnter += (o, args) => { PropertyItemOnMouseEnter(o, args, resolverEx); };
        propertyItem.MouseLeave += PropertyItemOnMouseLeave;

        // Set grid colour to transparent so it's hit testable and can pick up mouse events
        var groupbox = FindChild <Grid>(propertyItem, "");

        if (groupbox != null)
        {
            groupbox.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
        }
    }
コード例 #3
0
 public DateTimePropertyEditor(PropertyResolverEx propertyResolverEx) => Owner = propertyResolverEx;
コード例 #4
0
 public SwitchPropertyEditorEx(PropertyResolverEx propertyResolverEx) => Owner = propertyResolverEx;
コード例 #5
0
 public NumberPropertyEditor(double minimum, double maximum, PropertyResolverEx propertyResolverEx)
 {
     Minimum = minimum;
     Maximum = maximum;
     Owner   = propertyResolverEx;
 }
コード例 #6
0
 public EnumPropertyEditor(PropertyResolverEx propertyResolverEx) => Owner = propertyResolverEx;
コード例 #7
0
 public PlainTextPropertyEditor(PropertyResolverEx propertyResolverEx) => Owner = propertyResolverEx;
コード例 #8
0
 public StringWrapperEditor(PropertyResolverEx propertyResolverEx) => Owner = propertyResolverEx;
コード例 #9
0
 public static void AttachTooltipAdder(this PropertyItem propertyItem, PropertyResolverEx resolverEx)
 {
     propertyItem.Loaded += (sender, args) => { PropertyItemLoaded(sender, args, resolverEx, !string.IsNullOrEmpty(propertyItem.Description)); };
 }