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

Why is the set; never called on this variable when the collection is changed?

$
0
0

Hi! Ive been trying to get this code snippet to work for a while now, but cant figure out why the "Set;" is never called when i add items to the DropdownList, instead it just immidietly goes to the get; and then its done. Any ideas?

    public ObservableCollection<DropdownItem> DropdownList
    {
        protected set
        {
            if (_collection != value)
            {
            _collection = value;
            OnPropertyChanged();
            }
        }
        get { return _collection; }
    }

I have a similar object and the Set; works on this:

    public UInt16 U16Value
    {
        protected set
        {
            if (_UInt16val != value)
            {
                _UInt16val = value;
                OnPropertyChanged();
            }
        }
        get { return _UInt16val; }
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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