Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabControl 控件使用MVVM方式进行绑定,是否可以设置某个TabItem不允许关闭? #1619

Closed
2270969436 opened this issue Jul 13, 2024 · 1 comment

Comments

@2270969436
Copy link

Describe the bug

HandyControl的Demo的MVVM示例代码里面没看到设置TabItem控件ShowCloseButton属性的方法。
虽然我知道在XAML的TabItem可以设置属性,但我希望在MVVM模式下,也能进行这一项的设置。然后其中某些TabItem不允许关闭,部分TabItem可以关闭

Steps to reproduce the bug

            <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>

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

@2270969436
Copy link
Author

找到了,ItemsSource直接绑定TabItem集合就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant