Jaime
Jaime

Reputation: 605

Visibility binding on TextView not working

I am having problems binding Visibility to TextView. I have verified that the bound property returns a bool false. I also have a Checkbox whose Visibility is bound to the same property and that seems to work. See below:

<CheckBox
    android:id="@+id/checkBox1"
    local:MvxBind="Checked ConfirmLock; Visibility Visibility(ConfirmLockVisible)"
    style="@style/checkbox" />

<TextView
    android:text="Confirm Lock"
    android:textSize="18dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="4dp"
    localMvxBind="Visibility Visibility(ConfirmLockVisible)"
    style="@style/form_label.spacer" />

In the ViewModel:

private bool _confirmLockVisible;
public bool ConfirmLockVisible
{
    get { return _confirmLockVisible; }
    set
    {
        _confirmLockVisible = value;
        RaisePropertyChanged(() => ConfirmLockVisible);
    }
}

There is nothing special happening in the ViewModel, just that the property is being set based on data returned from a database query. And based on the behavior of the Checkbox, it appears that the property is set correctly.

Upvotes: 0

Views: 414

Answers (1)

Greg Shackles
Greg Shackles

Reputation: 10139

You're missing a : in your TextView binding there:

localMvxBind="Visibility Visibility(ConfirmLockVisible)"

should be

local:MvxBind="Visibility Visibility(ConfirmLockVisible)"

Upvotes: 1

Related Questions