我正在使用MahApps TabControl。如果我从xaml添加项目,我可以设置“CloseButtonEnabled = true”,并显示关闭按钮,当我尝试绑定ItemSource时,关闭按钮不会出现。任何想法,我怎么能解决这个问题?Mahapps TabControl,无法设置CloseButtonEnabled = true时使用ItemSource = {Binding ..}
这里是我的示例代码:
<Window.Resources>
<Style BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type Controls:MetroTabItem}">
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="15"/>
<Setter Property="Foreground" Value="Red"/>
<Setter Property="CloseButtonEnabled" Value="True"/>
</Style>
</Window.Resources>
<Controls:MetroTabControl ItemsSource="{Binding AvailableFiles}" SelectedIndex="{Binding SelectedIndex}" Grid.Row="1" >
<Controls:MetroTabControl.ItemTemplate >
<DataTemplate>
<TextBlock Text="{Binding Title}" />
</DataTemplate>
</Controls:MetroTabControl.ItemTemplate>
</Controls:MetroTabControl>
是的是的!它现在有效!谢谢。 – niks