I have a WPF treeview used to display a file structure. Each treeitem has a collection of enums to determine custom status’ of the item. I.E. ObservableCollection<enumType> statusCollection;
I have several ellipses that are displayed when a treeitem has one of these status… something like this:
<Ellipse Margin="3,0" Visibility="{Binding StatusCollection, Converter={StaticResource VisibilityConverter}}" StrokeThickness="1" Stroke="Black" Width="12" Height="12" Fill="Red" />
Is there a way I can use the same Converter for multiple ellipses to check for a specific status… via an argument perhaps? Right now in the Converter, i loop through the collection looking for the specific enum… doing this, I would have to create a new Converter for each enum created, which is not ideal.
Better yet, how would I go about dynamically creating Ellipses for each status in a treeviewitem?
You could add a
ConverterParameterto theBinding:This will then be passed into your
IValueConverteras theparameter(third parameter) inYou can then use the parameter within your converter however you need.