I'm having a WPF Custom Control
which represents me a given point on a plan (I'm making a guide application for my studies) and I want it to looks different for different categories of the objects represented by this map node (i.e. toilet, lift or normal room).
Could anyone give me some idea how to do this?
I tried creating a Converter but it didn't goes well. Also my problem is that sometimes in could be the WPF element like Ellipse and sometimes it should be an image.
Is it somehow possible to create custom control with multiple templates and the template will be selected depending on some category attribute?
For things like this, you might want to have a look at the DataTemplateSelector class. It allows you to select the datatemplate based on the actual object you are binding to.
Here's a tutorial for it, but i'm sure you can find more on the internet: http://www.switchonthecode.com/tutorials/wpf-tutorial-how-to-use-a-datatemplateselector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With