c# - XAML - Update text on different property update -
so have following xaml:
<textblock text="{binding disconnecteddevices, updatesourcetrigger=propertychanged}" />
the view model has following properties:
public string disconnecteddevices {get; set;} public ienumerable<ideviceinformationvm> devicecollection {get; set;}
there's method gets called raises property notified event:
public void devicecollectionchanged() { raisepropertychanged(() => devicecollection); }
i'd update value in textblock when devicecollection changes. i'm aware call raisepropertychanged on disconnecteddevices i'm wondering if possible update textblock on different property change event.
thanks all!
edit: suggestions using observablecollection instead of ienumerable, unfortunately, i'm not @ liberty change collection type..
the devicecollectionchanged method called whenever collection changes (tedious know...)
further edit: have gone ahead with
raisepropertychanged(() => disconnecteddevices);
i appreciate not enough information might have been provided in question trying do, apologies that
i not sure if current code works, assuming works. why not use - observablecollection<ideviceinformationvm>
instead of ienumerable<ideviceinformationvm> devicecollection
wont need devicecollectionchanged event. taken care.
yes can raise
public void devicecollectionchanged() { raisepropertychanged(() => devicecollection); raisepropertychanged(() => disconnecteddevices); // or raisepropertychanged("disconnecteddevices"); whichever works }
see question, might implementation of notifypropertychanged multiple properties- wpf notify propertychanged property
Comments
Post a Comment