Skip to content

Commit b1c0642

Browse files
OverflowMode.Always bug fix (#2540)
1 parent 9b3a6cb commit b1c0642

File tree

2 files changed

+217
-420
lines changed

2 files changed

+217
-420
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Controls;
5+
using System.Windows.Data;
6+
7+
namespace MaterialDesignThemes.Wpf.Converters
8+
{
9+
public class ToolBarOverflowButtonVisibilityConverter : IMultiValueConverter
10+
{
11+
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
12+
{
13+
var overflowMode = (OverflowMode)values[0];
14+
var hasOverflowItems = (bool)values[1];
15+
16+
if (overflowMode == OverflowMode.AsNeeded && hasOverflowItems)
17+
{
18+
return Visibility.Visible;
19+
}
20+
else
21+
{
22+
return overflowMode switch
23+
{
24+
OverflowMode.Always => Visibility.Visible,
25+
OverflowMode.Never => Visibility.Hidden,
26+
_ => Visibility.Hidden,
27+
};
28+
}
29+
}
30+
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
31+
}
32+
}

0 commit comments

Comments
 (0)