Hey SO, so I've got a custom control in Silverlight. Doesn't really matter what it is but its a big composite thing with a treeview, a slider, and some other junk.
Now in the control we have an instance variable which is called defaultTemplate. It is of type DataTemplate. Basically its the template that the TreeViewItem's use as their header template unless the application developer calls myControl.setTemplate(DataTemplate dt);
Just by making the property public and giving it getters and setters, it shows up in intellisense when I type the following...
<myNamespace:myControl x:Name="theControl" defa
Intellisense picks up on the fact that my class has a defaultTemplate property and it lists it as an option.
What I would like:
I would like for the above functionality to continue, but add functionality for intellisense to automatically list options for the values. So I have these data templates defined in a resource dictionary which the control has access to. I want them to popup as options when I get to this part of typing:
<myNamespace:myControl x:Name="theControl" defaultTemplate="_"
The functionality I'm, looking for can be found in the TextBlock's foreground property. As you type
foreground=""
its start to list colors for you to choose from. I would be fine with defining constants as the names of my data templates and having intellisense choose from those or something like that.
How can I acheive this? Thank you!
Clarification Edit: I need to make intellisense aware of a list of constants which are acceptable inputs for the xaml property. So my defaultTemplate property can just be a string. I'll deal with what that string means in my code behind. But I need intellisense to know what strings are ok to enter for that property in the XAML. The foreground color once you type the quote pops up a list in intellisense that is like "Azure, Beige... LemonChiffon... etc." How do I provide intellisense with that list? Thanks!
Final Edit: Thanks to siege898 I can now choice my values for defaultTemplate from a list that intellisense provides me. However, I would also like to be able to give the application developer (who uses my control) an option to define their own data template and specify the name of it.
So for example, Bob is using my control in his application. None of the templates I provide are suitable for him. So Bob creates in a resource dictionary a data template for his application called bobTemplate. I would like for Bob to be able to enter in the defaultTemplate field in xaml defaultTemplate="bobTemplate"
and not have that throw an error. I believe the problem I'm having now is because the field is expecting a value in my enum. Does anyone know how I can set this up to both give me the dropdown list generated from the enum, but still accept custom strings? I was thinking a type converter, but I'm not sure how to use it for what I want...