Set Visibility of Button depending from selected Tab

后端 未结 1 1302
清酒与你
清酒与你 2020-12-07 02:55

I have a Button and a TabControl with some Tabs. I want to hide the button, if the second tab is selected. This is my approach, but the button does not disappear if I click

相关标签:
1条回答
  • 2020-12-07 03:31

    Because you want to bind to the property of another element in your application you should use Binding.ElementName Property and Path like this:

    <DataTrigger Binding="{Binding  ElementName=TabMainControl, Path=SelectedIndex}" Value="1">
        <Setter Property="Visibility" Value="Hidden" />
    </DataTrigger>
    
    0 讨论(0)
提交回复
热议问题