public void AddFilter() { var dlg = ViewModelFactory.CreateViewModel <PropertySelectionTaskViewModel.Factory>() .Invoke(DataContext, this, _type, props => { if (props != null) { AddFilter(FilterModel.FromProperty(FrozenContext, props), true, props); OnUserFilterAdded(props); } }); dlg.FollowRelationsOne = true; dlg.FollowRelationsMany = false; // TODO: Not working yet, linq predicate is wrong ViewModelFactory.ShowDialog(dlg); }
private void Load() { Parent.FilterList.ResetUserFilter(); if (_selectedItem != null) { // Filter foreach (var f in _selectedItem.Object.Filter) { var props = f.Properties.Select(i => FrozenContext.FindPersistenceObject <Property>(i)).ToList(); var mdl = FilterModel.FromProperty(FrozenContext, props); int idx = 0; foreach (var val in f.Values ?? new object[] { }) { if (idx >= mdl.FilterArguments.Count) { break; } var valueMdl = mdl.FilterArguments[idx].Value; valueMdl.SetUntypedValue(ResolveUntypedValue(val, valueMdl)); idx++; } Parent.FilterList.AddFilter(mdl, true, props); } // Cols if (_selectedItem.Object.Columns != null && _selectedItem.Object.Columns.Count > 0) { Parent.DisplayedColumns.Columns.Clear(); foreach (var col in _selectedItem.Object.Columns) { var props = col.Properties.Select(i => FrozenContext.FindPersistenceObject <Property>(i)).ToArray(); Parent.DisplayedColumns.Columns.Add(GridDisplayConfiguration.CreateColumnDisplayModel(GridDisplayConfiguration.Mode.ReadOnly, props)); } } } }