Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

binding not firing in some cases

$
0
0

I have a view model, which is set as the binding context of my view.
I have a view which binds to one of the properties of the view model, which is a complex object.

I'm finding that the bindings are not firing for one of my properties "CurrentSpace" in the code below.

for now, I have to work around this, by manually setting it, but that's not gonna fly.

What could stop my controls getting values for bindings of this type? I breakpoint the getter, and there's no actual call to get any initial value from the CurrentSpace property - only changing them after the view is shown trigger the binding to lookup the getters.

i.e

<Label Text="{Binding TestText}" />
            <Label x:Name="TestLabel" Text="{Binding CurrentSpace}" />

These bind to :

`
ISubscribedSpace _currentSpace;

    public ISubscribedSpace CurrentSpace {
        get{ return _currentSpace; }
        set {
            SetProperty<ISubscribedSpace> (ref _currentSpace, value);
        }
    }

    string _testText;

    public string TestText {
        get{ return _testText; }
        set {
            SetProperty<string> (ref _testText, value);
        }
    }

`
I'm using ObservableObject (from xamarin forms labs for my viewmodels base class).

The CurrentSpace binding does nothing when the view appears. The TestText one works fine. If I update TestText, the label updates. If I update CurrentSpace, nothing happens.

Unsure why this is the case; but it's happening in all my view models. I wouldn't be surprised if this is another xamarin forms issue, though (I'll be ditchign it soon, some helpful stuff, but a lot of bugs I think).


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>