【问题标题】:Binding Value in Setter for TabItem is Not WorkingTabItem 的 Setter 中的绑定值不起作用
【发布时间】:2016-07-12 07:54:20
【问题描述】:

我试过的是

                <TabControl.ItemContainerStyle>
                    <Style TargetType="{x:Type TabItem}">
                        <Setter Property="IsEnabled"  Value="{Binding Active }"/>
                    </Style>
                </TabControl.ItemContainerStyle>

当我给 Value=false 时,它的工作。
尝试了一堆其他的东西,没有任何帮助。
谢谢


编辑 下面是我的ItemTemplate,按预期工作,意味着没有绑定错误。

 <TabControl.ItemTemplate>
           <DataTemplate>
               <TextBlock FontSize="20" Text="{Binding Display}"></TextBlock>                 
            </DataTemplate>
  </TabControl.ItemTemplate>

【问题讨论】:

  • 所以,如果它在没有Binding &lt;Setter Property="IsEnabled" Value="False"/&gt; 的情况下工作,问题可能出在您的视图模型中。可以与我们分享视图模型吗?
  • 查看绑定错误。

标签: wpf xaml data-binding mvvm-light


【解决方案1】:

我发现我的错误,

错过了{get;set} in

public bool Active { get; set; }

【讨论】:

    猜你喜欢
    • 2016-06-22
    • 2018-11-18
    • 1970-01-01
    • 1970-01-01
    • 2019-12-24
    • 2017-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多