Emlyn

London, United Kingdom

trigonal.co.uk

Age: 32

Feb
15
comment Cast Observable Collection from base Class to inherited class
My real issue is how to remove the repeated code which needs to reference the GridData observable collection (But is only interested in the MessageParentBase class fields) in the base class of the ViewModel while still being able to initiate the observable collection as a ChatMessage one. I thought I could declare the field in the base viewmodel and then Declare the property in the derived ViewModel but I'm being told I cannot implicity convert from one ObservableCollection to another even though one class inherits from the other.
Feb
15
comment Cast Observable Collection from base Class to inherited class
I've tried this approach but as the GridData is declared as ObservableCollection<MessageParentBase>() it still does not display the fields from the derived class.
Feb
15
comment Cast Observable Collection from base Class to inherited class
Ah I was thinking this was the case. Is there someway I can have some reference in base class as a lot of the functionality I was hoping to move to this class is not looking for specific of the ChatMessage class and this observable collection. Otherwise I'm going to have a lot of repeated code for each viewmodel which uses a different derived class from MessageParentBase.
Feb
15
comment Cast Observable Collection from base Class to inherited class
Hopefully my edit helps explain my question some more.
Feb
15
revised Cast Observable Collection from base Class to inherited class
added 937 characters in body
Feb
15
revised Cast Observable Collection from base Class to inherited class
added 937 characters in body
Feb
15
accepted High unmanaged Memory - WPF Application
Feb
15
asked Cast Observable Collection from base Class to inherited class
Nov
30
awarded Notable Question
Sep
9
awarded Notable Question
Jul
11
comment High unmanaged Memory - WPF Application
Apologies for my ignorance, what do you mean by a long repeater control?
Jul
11
asked High unmanaged Memory - WPF Application
Jul
9
asked WPF UserControl Hosted in Popup Window not taking focus
Jul
9
accepted Pass parameter to Execute and CanExecute relaycommand WPF MVVM Light
Jul
9
asked WPF Focus visible window when main window minimized
Jun
7
asked Pass parameter to Execute and CanExecute relaycommand WPF MVVM Light
May
29
awarded Self-Learner
May
29
awarded Tumbleweed
Feb
15
awarded Popular Question
Jan
19
awarded Commentator
1 2 3