I'm developing a SL4 application that alternates between different usercontrols on timer_tick event.
Previously I was doing it the old way of passing parameters to the usercontrol. I've now stored the data I need in an ObservableCollection, which I've bound to the USerControl's datacontext. The main reason for this change being that I need the field on the UserControl fields to update automatically as the data in the collection changes due to WCF calls etc.. (Please correct me if I'm doing things wrong here..)
There are two things I need to do if possible:
1) The collection holds decimal types, and I'd like to keep it this way, but I need to add a suffix to the TextBlock that is bound to the decimal. So, the value of the decimal is 202, I need to add "kWh" to the TextBlock. If not, I'll have to look at the collection holding strings.
2 I need to GET some of the data from the DataContext in code behind of the UserControl, to do some calcs before I then use on the UI. Is this possible? Can I Get data from the datacontext in any way?