Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Filtering Data
posted

Hey Guys

Is it possible to do something like this:

in view model
filters = new BindingList<RecordFilter>();
ComparisonCondition ConditionDeliveryDate = new ComparisonCondition(ComparisonOperator.Equals, true);
RecordFilter g = new RecordFilter { FieldName = "IsPassed" };

Then pass filters  into a view?

Esentially what we currently have is a cobobox drop down where the user make a selection.
Then based on what the user selects the grid is filter to that perspective.

In order for this to work we have to publish what the user selected, this is done in the view model,
and then subscribe to it in the code behind the view.

This breaks the mvvm pattern

Thoughts or comments welcomed

  • 12004
    Verified Answer
    posted

    Hello JDwayne,

    As far as passing data in the View from the ViewModel you can bind using a StaticResource with a Path set and assigning a key to the ViewModel from Resources. E.g.

    <TextBlock Text="{Binding Path=Selected, Source={StaticResource vm1}}" />