Skip to content

Commit 80bff28

Browse files
committed
Enabled hiding the drop arrow on Winforms and WPF.
1 parent 6f87240 commit 80bff28

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/Eto.WinForms/Forms/ToolBar/DropDownToolItemHandler.cs

+9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ public override bool Enabled
3737
set { Control.Enabled = value; }
3838
}
3939

40+
/// <summary>
41+
/// Gets or sets whether the drop arrow is shown on the button.
42+
/// </summary>
43+
public bool ShowDropArrow
44+
{
45+
get { return Control.ShowDropDownArrow; }
46+
set { Control.ShowDropDownArrow = value; }
47+
}
48+
4049
public override void CreateControl(ToolBarHandler handler, int index)
4150
{
4251
handler.Control.Items.Insert(index, Control);

src/Eto.Wpf/Forms/ToolBar/DropDownToolItemHandler.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class DropDownToolItemHandler : ToolItemHandler<swc.Menu, DropDownToolIte
1414
readonly swc.Image swcImage;
1515
readonly swc.TextBlock label;
1616
readonly swc.MenuItem root;
17+
readonly sw.Shapes.Path arrow;
1718

1819
public DropDownToolItemHandler ()
1920
{
@@ -22,7 +23,7 @@ public DropDownToolItemHandler ()
2223
Control.Items.Add(root);
2324
swcImage = new swc.Image { MaxHeight = 16, MaxWidth = 16 };
2425
label = new swc.TextBlock();
25-
var arrow = new sw.Shapes.Path { Data = swm.Geometry.Parse("M 0 0 L 3 3 L 6 0 Z"), VerticalAlignment = sw.VerticalAlignment.Center, Margin = new Thickness(8, 2, 0, 0), Fill = swm.Brushes.Black };
26+
arrow = new sw.Shapes.Path { Data = swm.Geometry.Parse("M 0 0 L 3 3 L 6 0 Z"), VerticalAlignment = sw.VerticalAlignment.Center, Margin = new Thickness(8, 2, 0, 0), Fill = swm.Brushes.Black };
2627
var panel = new swc.StackPanel { Orientation = swc.Orientation.Horizontal, Children = { swcImage, label, arrow } };
2728

2829
root.Header = panel;
@@ -72,6 +73,15 @@ public override bool Enabled
7273
}
7374
}
7475

76+
/// <summary>
77+
/// Gets or sets whether the drop arrow is shown on the button.
78+
/// </summary>
79+
public bool ShowDropArrow
80+
{
81+
get { return arrow.Visibility == Visibility.Visible; }
82+
set { arrow.Visibility = value ? Visibility.Visible : Visibility.Collapsed; }
83+
}
84+
7585
public void AddMenu(int index, MenuItem item)
7686
{
7787
root.Items.Insert(index, (swc.MenuItem)item.ControlObject);

0 commit comments

Comments
 (0)