wpf toolbar bug: ToolBar.Overflowmode does not work in binding scenarios
This works (places the button in the overflow area):
<ToolBar>
<Button ToolBar.OverflowMode="Always">Hit me</Button>
</ToolBar>
This does not (does not place/keep the button in the overflow area):
<开发者_开发知识库;ToolBar Grid.Row="3" ItemsSource="{Binding Path=Groups[0].Items}"></ToolBar>
<DataTemplate DataType="{x:Type local:ItemViewModel}">
<Button ToolBar.OverflowMode="Always">Hit me</Button>
</DataTemplate>
Does anyone know if there is a workaround for this problem?
I found a way of applying overflow to all items, and using a custom style selector, you can probably tailor the overflow to only refer to the items relevant for you.
Static version:
<Style x:Key="itemContainerStyle">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Description}" Value="Foo">
<Setter Property="ToolBar.OverflowMode" Value="Always"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="ToolBar">
<Setter Property="ItemContainerStyle" Value="{StaticResource itemContainerStyle}"></Setter>
</Style>
精彩评论