I have the following question: In my view model I have a list with an object that has a property Name and Value, both strings. I want to bind the list to a combo box in my view, but I want to display only the elements that have a certain name. For the list:
Name    Value
foo    aaa
bar    bbbb
foo    ccc
I want to display in the combobox only the elements that have the name foo, aaa and ccc. The catch here is that I want to do the filter in the view and not in the codebehind or the viewmodel.
ViewCode:
<ComboBox IsEditable="True" VerticalAlignment="Top"
HorizontalAlignment="Left" Width="150" Margin="60,60,0,0"
ItemsSource="{Binding Elements}"
SelectedValue="{Binding Value}" SelectedValuePath="Value"
DisplayMemberPath="Value" />
ViewModel Code:
private List<CustomChartElement> elements;
public List<CustomChartElement> Elements
{
get { return this.elements; }
}