What are resources in WPF? (C# WPF Interview questions with answers)
Resources are objects referred in WPF XAML. In C# code when we create an object we do the following three steps:-
So even in WPF XAML to define resources which are nothing but objects we need to the above 3 steps :-
- Import namespace where the class resides: - To define namespace we need to use the "xmlns" attribute as shown in the below XAML code.
- Create object of the class :- To create an object of the class in XAML we need to create a resource by using the resource tag as the below code. You can the object name is 'custobj".
The above code you can map to something like this in C#
- Bind the object with UI objects :- Once the object is created we can then bind them using bindings like one way , two way as explained in "Explain one way, two way, one time and one way to source?".
Please see this WPF binding interview question from here http://questpond.blog.com/2013/11/11/explain-wpf-bindings-net-wpf-binding-interview-questions/
Below video explain what is WPF and how they differ from Windows form