private static void OnDoubleClickCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DataPresenterBase presenter = (DataPresenterBase)d; presenter.MouseDoubleClick += (o, ea) => { ICommand command = (ICommand)presenter.GetValue(DoubleClickCommandProperty); object commandParameter = presenter.GetValue(DoubleClickCommandParameterProperty); if (command.CanExecute(commandParameter)) { command.Execute(commandParameter); } }; }
static void ApplySortDirection_On_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e) { DataPresenterBase presenter = (DataPresenterBase)sender; presenter.FieldLayoutInitialized -= ApplySortDirection_On_FieldLayoutInitialized; if (presenter.FieldLayouts.Count < 1) { return; } if (presenter.FieldLayouts[0].SortedFields.Count < 1) { return; } presenter.FieldLayouts[0].SortedFields.Clear(); string fieldName = (string)presenter.GetValue(XamDataPresenterBase.GroupByFieldNameProperty); ListSortDirection sortDirection = (ListSortDirection)presenter.GetValue(XamDataPresenterBase.SortDirectionProperty); presenter.FieldLayouts[0].SortedFields.Add(new FieldSortDescription(fieldName, sortDirection, true)); }
private static void OnGroupByFieldNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DataPresenterBase presenter = (DataPresenterBase)d; string fieldName = (string)e.NewValue; ListSortDirection sortDirection = (ListSortDirection)presenter.GetValue(XamDataPresenterBase.SortDirectionProperty); if (presenter.FieldLayouts.Count < 1) { return; } presenter.FieldLayouts[0].SortedFields.Clear(); presenter.FieldLayouts[0].SortedFields.Add(new FieldSortDescription(fieldName, sortDirection, true)); }
private static void OnFilterValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DataPresenterBase presenter = (DataPresenterBase)d; string filterValue = (string)e.NewValue; string[] filterByFields = ReadCsvs((string)presenter.GetValue(XamDataPresenterBase.FilterByFieldsProperty)); //If the field layout is not initialized or the FilterByFields property is not set return. if (presenter.FieldLayouts.Count <= 0 || filterByFields.Length == 0) { return; } //Clear any exisitng filters presenter.FieldLayouts[0].RecordFilters.Clear(); //If the filter is empty return if (string.IsNullOrEmpty(filterValue)) { return; } //Make sure the filter action is Hide presenter.FieldLayoutSettings.FilterAction = RecordFilterAction.Default; presenter.FieldLayoutSettings.RecordFiltersLogicalOperator = LogicalOperator.Or; //Create the filters foreach (var fieldName in filterByFields) { ComparisonCondition condition = new ComparisonCondition(); condition.Operator = ComparisonOperator.Contains; condition.Value = filterValue; RecordFilter rFilter = new RecordFilter(); rFilter.FieldName = fieldName; rFilter.Conditions.Add(condition); presenter.FieldLayouts[0].RecordFilters.Add(rFilter); } }
private static void OnSortDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DataPresenterBase presenter = (DataPresenterBase)d; ListSortDirection sortDirection = (ListSortDirection)e.NewValue; string fieldName = (string)presenter.GetValue(XamDataPresenterBase.GroupByFieldNameProperty); //Sort direction was set before the layout was initialized if (presenter.FieldLayouts.Count < 1) { presenter.FieldLayoutInitialized += ApplySortDirection_On_FieldLayoutInitialized; return; } if (presenter.FieldLayouts[0].SortedFields.Count < 1) { return; } presenter.FieldLayouts[0].SortedFields.Clear(); presenter.FieldLayouts[0].SortedFields.Add(new FieldSortDescription(fieldName, sortDirection, true)); }
public static string GetGroupByFieldName(DataPresenterBase presenter) { return(presenter.GetValue(GroupByFieldNameProperty) as string); }
public static object GetDoubleClickCommandParameter(DataPresenterBase grid) { return(grid.GetValue(DoubleClickCommandParameterProperty)); }
public static ICommand GetDoubleClickCommand(DataPresenterBase grid) { return(grid.GetValue(DoubleClickCommandProperty) as ICommand); }
public static string GetFilterByFields(DataPresenterBase presenter) { return(presenter.GetValue(FilterByFieldsProperty) as string); }