Question

I have a string collection that is bound to a MenuItem as it's ItemsSource (the strings are user added bookmarks representing folder paths). However, within the string collection I might have a string of, say, hyphens ("----") that I want to be displayed as a Separator element. However, the Separator is different from a MenuItem element. I need some way to convert the applicable string to a Separator element.

What is the best way to handle this?

Was it helpful?

Solution

Take a look at this answer WPF optical style of dynamically created MenuItem-Separator in MVVM

and this blog post: http://www.zagstudio.com/blog/440#.UJ2_lofaW_w

Basically what you need to do is to to add the "separator" item as an item in the source collection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top