tags:

views:

33

answers:

1

I have the following xaml inside a text box element that is part of a combo box item template. The combobox's items source is set to a list of objects that have a boolean property AcceptsInput everything works great but I can't get this trigger to fire do I have to do something else.

<TextBox.Style>
    <Style TargetType="TextBox">
          <Style.Triggers>
              <DataTrigger Binding="{Binding AcceptsInput}" Value="False" >
                   <Setter Property="Visibility" Value="Hidden"> </Setter>
               </DataTrigger>
           </Style.Triggers>
     </Style>
</TextBox.Style>
+2  A: 

Are you correctly implementing INotifyPropertyChanged in the viewmodel class with the AcceptsInput property?

It should look something like this:

public class MyClass: INotifyPropertyChanged
{

    private bool _acceptsInput;
    public bool AcceptsInput
    {
        get { return _acceptsInput; }
        set
        {

            _acceptsInput = value;
            OnPropertyChanged("AcceptsInput");
        }
    }
...
}
marinade