WPF Coding Research

WPF Research

Notes From .wpf-tutorial.com


Global Exception catch

Resource Files

Can exist on control, parent or application level. XAML:

Static: defined once and stay the same when called

Dynamic: updated every time it’s called (so can change data behind it)

Finding Resources

e.g. in Application:

‘Cascades’ down the control tree – so Control.FindResource("myres")  first looks in the control, then down the parents and finally in the application resources.

Canvas control


Data Binding


Keeping Objects and data bindings in sync

Example here: https://www.wpf-tutorial.com/data-binding/responding-to-changes/

Basically, don’t use List(Of T) for collections. use  ObservableCollection(of T) instead. Then, any changes in the datasource will be updated to the object. That is the object observes binding.

For the other way (Object update > Data Binding), use INotifyPropertyChanged. Code examples below:


Middleman between data and object (where type mismatch may occur or you need translation (e.g. False into a red cross image).

Command Bindings

Provide a ‘middleman’ between objects and actions. A command has 2 properties – CanExecute and Executed – both point to a sub. If CanExecute is set to false, then all bound objects will be their version of disabled. Enables App wide setting of controls that serve the same function.

Triggers – Property, Data and Event

XAML code:


General Notes


Winforms WPF
Timer Dispatch Timer

Be the first to comment

Leave a Reply

Your email address will not be published.