Skip to content

Commit c3f9d9f

Browse files
Update IsItemsHost on changes to Visibility rather than IsVisible (#3073)
1 parent 0729bbc commit c3f9d9f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

MaterialDesignThemes.Wpf/TabAssist.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ public static class TabAssist
1616

1717
public static bool GetHasUniformTabWidth(DependencyObject element) => (bool)element.GetValue(HasUniformTabWidthProperty);
1818

19-
internal static bool GetBindableIsItemsHost(DependencyObject obj)
20-
=> (bool)obj.GetValue(BindableIsItemsHostProperty);
19+
internal static Visibility GetBindableIsItemsHost(DependencyObject obj)
20+
=> (Visibility)obj.GetValue(BindableIsItemsHostProperty);
2121

22-
internal static void SetBindableIsItemsHost(DependencyObject obj, bool value)
22+
internal static void SetBindableIsItemsHost(DependencyObject obj, Visibility value)
2323
=> obj.SetValue(BindableIsItemsHostProperty, value);
2424

2525
internal static readonly DependencyProperty BindableIsItemsHostProperty =
26-
DependencyProperty.RegisterAttached("BindableIsItemsHost", typeof(bool), typeof(TabAssist), new PropertyMetadata(false, OnBindableIsItemsHostChanged));
26+
DependencyProperty.RegisterAttached("BindableIsItemsHost", typeof(Visibility), typeof(TabAssist), new PropertyMetadata(Visibility.Collapsed, OnBindableIsItemsHostChanged));
2727

2828
private static void OnBindableIsItemsHostChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
2929
{
3030
if (d is Panel panel)
3131
{
32-
panel.IsItemsHost = (bool)e.NewValue;
32+
panel.IsItemsHost = (Visibility)e.NewValue == Visibility.Visible;
3333
}
3434
}
3535
}

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
5151
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
5252
Focusable="False"
53-
wpf:TabAssist.BindableIsItemsHost="{Binding IsVisible, RelativeSource={RelativeSource Self}}"
53+
wpf:TabAssist.BindableIsItemsHost="{Binding Visibility, RelativeSource={RelativeSource Self}}"
5454
KeyboardNavigation.TabIndex="1"
5555
Rows="1" />
5656
<VirtualizingStackPanel x:Name="HeaderPanel"
5757
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
5858
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
5959
Focusable="False"
60-
wpf:TabAssist.BindableIsItemsHost="{Binding IsVisible, RelativeSource={RelativeSource Self}}"
60+
wpf:TabAssist.BindableIsItemsHost="{Binding Visibility, RelativeSource={RelativeSource Self}}"
6161
KeyboardNavigation.TabIndex="1"
6262
Orientation="Horizontal" />
6363
</StackPanel>

0 commit comments

Comments
 (0)