Closed 2270969436 closed 3 months ago
HandyControl的Demo的MVVM示例代码里面没看到设置TabItem控件ShowCloseButton属性的方法。 虽然我知道在XAML的TabItem可以设置属性,但我希望在MVVM模式下,也能进行这一项的设置。然后其中某些TabItem不允许关闭,部分TabItem可以关闭
<hc:TabControl Grid.Row="2" IsAnimationEnabled="True" Margin="0,32,0,0" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" MaxWidth="800" Height="300" OverflowMenuDisplayMemberPath="Header"> <TabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Header}"/> </DataTemplate> </TabControl.ItemTemplate> <TabControl.ContentTemplate> <DataTemplate> <hc:SimplePanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding BackgroundToken,Converter={StaticResource String2BrushConverter}}"/> </DataTemplate> </TabControl.ContentTemplate> </hc:TabControl>
No response
HandyControl 3.4.0
Visual Studio 2022
.Net 6.0
Windows 11 (22000)
找到了,ItemsSource直接绑定TabItem集合就可以了
Describe the bug
HandyControl的Demo的MVVM示例代码里面没看到设置TabItem控件ShowCloseButton属性的方法。 虽然我知道在XAML的TabItem可以设置属性,但我希望在MVVM模式下,也能进行这一项的设置。然后其中某些TabItem不允许关闭,部分TabItem可以关闭
Steps to reproduce the bug
Expected behavior
No response
Screenshots
No response
NuGet package version
HandyControl 3.4.0
IDE
Visual Studio 2022
Framework type
.Net 6.0
Windows version
Windows 11 (22000)
Additional context
No response