How add MenuBar to Eto.Panel

Wonderful.

image

Thanks a lot. I didn’t start the MAC Version yet, but good to know the NSSegementedControl even though can’t find it right now.

kindest
Christian

Sorry, this is more of an implementation detail. On Mac, Eto will use the NSSegmentedControl (which is a native AppKit control) when using Eto’s SegmentedButton. It is a very common element in macOS UI so it should fit right in without any changes to your code.

No need for apologies. :wink: I will see how the MAC implementation will go. Could you let me know how the internal code for the style “nofocusnoborder” looks like?

That would be much appreciated.

Kindest
Christian

Absolutely, this is what that style does:

      Style.Add<Eto.Forms.ThemedControls.ThemedSegmentedButtonHandler>("nofocusnoborder", h =>
      {
        h.Control.Styles.Add<ToggleButtonHandler>(null, hdlr =>
        {
          hdlr.Control.Focusable = false;
          hdlr.Control.BorderThickness = new System.Windows.Thickness(0.0);
          hdlr.Control.Background = System.Windows.Media.Brushes.Transparent;
          // since we have no border, set the image opacity when not enabled 
          var trigger = new System.Windows.Trigger { Property = System.Windows.UIElement.IsEnabledProperty, Value = false };
          trigger.Setters.Add(new System.Windows.Setter(System.Windows.UIElement.OpacityProperty, 0.5));
          var style = new System.Windows.Style();
          style.Triggers.Add(trigger);
          hdlr.Control.Style = style;
        });
      });
2 Likes

Great. Thanks a lot and have a nice weekend.

Christian

1 Like