private void WorkSubsectionsComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { AllowToWorkerCategoryCheckBox.IsChecked = false; var workSubsection = WorkSubsectionsComboBox.SelectedItem as DataRowView; if (workSubsection == null) { WorkOperationsListBox.ItemsSource = null; _choosenOperationsTable.Clear(); return; } var workSubSectionId = Convert.ToInt64(workSubsection["WorkSubsectionID"]); var workOperations = _catalogClass.GetWorkOperations(); workOperations.RowFilter = string.Format("WorkSubsectionID IN ({0}, -1) AND Visible = True", workSubSectionId); var operationsCollectionView = new BindingListCollectionView(workOperations); if (operationsCollectionView.GroupDescriptions != null) { operationsCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("OperationTypeID", new OperationTypeConverter())); operationsCollectionView.SortDescriptions.Add(new SortDescription("OperationTypeID", ListSortDirection.Ascending)); } WorkOperationsListBox.ItemsSource = operationsCollectionView; _choosenOperationsTable.Clear(); }
private void FillBindings() { var workerAdmissions = _admClass.WorkerAdmissionsTable.AsDataView(); var workerAdmissionsView = new BindingListCollectionView(workerAdmissions); if (workerAdmissionsView.GroupDescriptions != null) { workerAdmissionsView.GroupDescriptions.Add(new PropertyGroupDescription("AdmissionID")); } workerAdmissionsView.CustomFilter = string.Format("WorkerID = {0}", _workerId); WorkerAdmissionsListBox.ItemsSource = workerAdmissionsView; AdmissionsComboBox.ItemsSource = _admClass.GetAdmissionsView(); var workerProfessionsView = _staffClass.GetWorkerProfessions(); workerProfessionsView.RowFilter = string.Format("WorkerID = {0}", _workerId); _workerProfessionsTable = workerProfessionsView.ToTable(); _workerProfessionsTable.Columns.Add(new DataColumn("IsSelected", typeof(bool))); WorkerProfessionsItemsControl.ItemsSource = _workerProfessionsTable.DefaultView; BindingGroupComboBox(); BindingFactoryComboBox(); BindingWorkUnitsComboBox(); BindingWorkSectionsComboBox(); BindingWorkSubsectionsComboBox(); _choosenOperationsTable = _catalogClass.WorkOperationsDataTable.Clone(); ChoosenOperationsListBox.ItemsSource = _choosenOperationsTable.AsDataView(); }
private void FilterWorkers() { if (WorkersGroupsComboBox.Items.Count == 0) { return; } if (FactoriesComboBox.Items.Count == 0) { return; } var staffDataTable = _sc.FilterWorkers(Convert.ToInt32(WorkersGroupsComboBox.SelectedValue), Convert.ToInt32(FactoriesComboBox.SelectedValue)); BindingListCollectionView cv = null; if (staffDataTable != null) { cv = new BindingListCollectionView(staffDataTable.DefaultView); if (cv.GroupDescriptions != null) { cv.GroupDescriptions.Add(new PropertyGroupDescription("Name", new FirstLetterConverter())); cv.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); } } WorkersNamesListBox.ItemsSource = cv; WorkersNamesListBox.SelectedIndex = 0; WorkersNamesListBox_SelectionChanged(null, null); }
private void btnLast_Click(object sender, RoutedEventArgs e) { BindingListCollectionView view1 = CollectionViewSource.GetDefaultView(transDataSet.Tables[0].DefaultView) as BindingListCollectionView; view1.MoveCurrentToLast(); this.OpenOrdersListView.ScrollIntoView(this.OpenOrdersListView.Items.CurrentItem); }
private void Window1_Loaded(object sender, RoutedEventArgs e) { IQueryable <Order> query = from o in db.Orders.Include("OrderDetails") //where o.OrderDate >= System.Convert.ToDateTime("1/1/2009") orderby o.OrderDate descending, o.Customer.LastName select o; this.OrderData = new OrdersCollection(query, db); IQueryable <Customer> customerList = from c in db.Customers where c.Orders.Count > 0 orderby c.LastName, c.FirstName select c; IQueryable <Product> productList = from p in db.Products orderby p.Name select p; this.MasterViewSource = (CollectionViewSource)this.FindResource("MasterViewSource"); this.DetailViewSource = (CollectionViewSource)this.FindResource("DetailsViewSource"); this.MasterViewSource.Source = this.OrderData; CollectionViewSource customerSource = (CollectionViewSource)this.FindResource("CustomerLookup"); customerSource.Source = customerList.ToList(); // A simple list is OK here since we are not editing Customers CollectionViewSource productSource = (CollectionViewSource)this.FindResource("ProductLookup"); productSource.Source = productList.ToList(); // A simple list is OK here since we are not editing Products this.MasterView = (ListCollectionView)this.MasterViewSource.View; MasterView.CurrentChanged += new EventHandler(MasterView_CurrentChanged); this.DetailsView = (BindingListCollectionView)this.DetailViewSource.View; }
public static ListView createListView(IList sourceView, ViewBase view, int itemsApproximation, ref int itemIndex, Rect size, out BindingList <object> list) { ListView listview = new ListView(); // Setting view if (view != null) { listview.View = UIUtility.CreateDeepCopy <ViewBase>(view); listview.UpdateLayout(); } // Create Itemssource list = new BindingList <object>(); BindingListCollectionView collectionViewSource = new BindingListCollectionView(list); listview.ItemsSource = collectionViewSource; //listview.GroupStyle.Add(printableListView.PrintGroupStyle); StackPanel body = new StackPanel(); body.Children.Add(listview); // Add the estimated items to the listview int currentPosition = itemIndex; for (int i = 0; i < itemsApproximation && i + currentPosition < sourceView.Count; i++) { object item = sourceView[itemIndex]; list.Add(item); itemIndex++; } collectionViewSource.Refresh(); // Calculate the size of listview listview.Measure(new Size()); body.Arrange(new Rect()); // Recorrect the items inside listview while (listview.ActualHeight < size.Height && itemIndex < sourceView.Count) { object item = sourceView[itemIndex]; list.Add(item); itemIndex++; collectionViewSource.Refresh(); listview.Measure(new Size()); body.Arrange(size); } while (listview.ActualHeight > size.Height && itemIndex >= 0) { list.Remove(list[list.Count - 1]); itemIndex--; collectionViewSource.Refresh(); listview.Measure(new Size()); body.Arrange(size); } body.Children.Clear(); return(listview); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (ControlsHelper.IsDesignMode(this)) { return; } // List which contains all issues. var scheduler = TaskScheduler.FromCurrentSynchronizationContext(); IssueList = new BindingListInvoked <IssueItem>(); UpdateIgnoreAllButton(); // List which is bound to the grid and displays issues, which needs user attention. Warnings = new BindingListInvoked <IssueItem>(); Warnings.SynchronizingObject = scheduler; WarningsView = new BindingListCollectionView(Warnings); MainDataGrid.ItemsSource = WarningsView; UpdateIgnoreButton(); // Timer which checks for the issues. var ai = new JocysCom.ClassLibrary.Configuration.AssemblyInfo(); var title = ai.GetTitle(true, true, true, true, false) + " - Issues"; TasksTimer = new QueueTimer <object>(0, 0); TasksTimer.DoWork += QueueTimer_DoWork; TasksTimer.Queue.ListChanged += Data_ListChanged; // Start monitoring tasks queue. QueueMonitorTimer = new System.Windows.Forms.Timer(); QueueMonitorTimer.Tick += QueueMonitorTimer_Tick; QueueMonitorTimer.Start(); }
public void UpdateSettingsMap() { var o = SettingsManager.Options; SettingsManager.LoadAndMonitor(o, nameof(Options.DebugMode), DebugModeCheckBox); GameScanLocationsView = new BindingListCollectionView(o.GameScanLocations); GameScanLocationsListBox.ItemsSource = GameScanLocationsView; SettingsManager.LoadAndMonitor(o, nameof(Options.GameScanLocations), GameScanLocationsListBox); SettingsManager.LoadAndMonitor(o, nameof(Options.StartWithWindows), StartWithWindowsCheckBox); StartWithWindowsStateComboBox.ItemsSource = Enum.GetValues(typeof(System.Windows.Forms.FormWindowState)); SettingsManager.LoadAndMonitor(o, nameof(Options.StartWithWindowsState), StartWithWindowsStateComboBox); SettingsManager.LoadAndMonitor(o, nameof(Options.AlwaysOnTop), AlwaysOnTopCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.AllowOnlyOneCopy), AllowOnlyOneCopyCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.EnableShowFormInfo), ShowFormInfoCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.ShowTestButton), ShowTestButtonCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.GuideButtonAction), GuideButtonActionTextBox); SettingsManager.LoadAndMonitor(o, nameof(Options.AutoDetectForegroundWindow), AutoDetectForegroundWindowCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.IsProcessDPIAware), IsProcessDPIAwareCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.MinimizeToTray), MinimizeToTrayCheckBox); // Direct Input SettingsManager.LoadAndMonitor(o, nameof(Options.ExcludeVirtualDevices), ExcludeVirtualDevicesCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.ExcludeSupplementalDevices), ExcludeSupplementalDevicesCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.UseDeviceBufferedData), UseDeviceBufferedDataCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.AcquireHiddenDevicesInExclusiveMode), AcquireHiddenDevicesInExclusiveModeCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.AcquireMappedDevicesInExclusiveMode), AcquireMappedDevicesInExclusiveModeCheckBox); // Load other settings manually. SettingsManager.LoadAndMonitor(o, nameof(Options.ShowProgramsTab), ShowProgramsTabCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.ShowSettingsTab), ShowSettingsTabCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.ShowDevicesTab), ShowDevicesTabCheckBox); SettingsManager.LoadAndMonitor(o, nameof(Options.IncludeProductsInsideINI), IncludeProductsCheckBox); }
private BindingListCollectionView GetDetailActionView() { var table = new DataTable(); table.Columns.Add("ActionTypeID", typeof(Int64)); table.Columns.Add("ModuleID", typeof(Int64)); table.Columns.Add("ModuleName", typeof(string)); table.Columns.Add("ActionName", typeof(string)); var joinTable = _ac.ActionTypesTable.AsEnumerable().Join(_ac.ModulesTable.AsEnumerable(), outer => outer["ModuleID"], inner => inner["ModuleID"], (outer, inner) => { var newRow = table.NewRow(); newRow["ActionTypeID"] = outer["ActionTypeID"]; newRow["ModuleID"] = outer["ModuleID"]; newRow["ModuleName"] = inner["ModuleName"]; newRow["ActionName"] = outer["ActionName"]; return(newRow); }).CopyToDataTable(); var view = new BindingListCollectionView(joinTable.DefaultView); view.GroupDescriptions.Add(new PropertyGroupDescription("ModuleID")); view.SortDescriptions.Add(new SortDescription("ModuleName", ListSortDirection.Ascending)); view.SortDescriptions.Add(new SortDescription("ActionName", ListSortDirection.Ascending)); return(view); }
/// <summary> /// Löschen der Anlagendaten im Projekt und Einügen der Daten des aktuell ausgewählten Schiffes. /// </summary> /// <param name="s">Das Schiffsobjekt das ausgewählt wurde</param> /// <param name="blView">Die View in der die Anlagen angezeigt werden.</param> private void setSchiffAnlagen(schiff s, BindingListCollectionView blView) { int c = blView.Count - 1; for (int i = c; i >= 0; i--) { blView.RemoveAt(i); } var anl = from sa in db.SchiffAnlage where sa.id_Schiff == s.id select sa; foreach (var item in anl) { if (blView != null) { var agg = (projektAggregat)(blView.AddNew()); agg.id_aggregat = item.id_Anlage; agg.Kennzeichen = item.Kennzeichen; agg.Bemerkung = item.Bemerkung; blView.CommitNew(); } } }
private void ShowTrajButton_Clicked(object sender, RoutedEventArgs e) { int tid = 0; if (tds != null) { singletrajectory.Children.Clear(); clearTrajectoryText(); //Draw Trajectory if (int.TryParse(tidtextblock.Text, out tid) && tds.trajectories.FindByt_id(tid) != null) { DrawTrajectory(tid, Colors.Red, "N", singletrajectory); updateTrajectoryText(tid); //highlightRow(tid); } //Open Point Window if (int.TryParse(tidtextblock.Text, out tid)) { pw = new PointsWindow(); pw.Show(); TrajectoryDbDataSet.pointsRow[] rows = tds.points.Select(string.Format("t_id={0}", tid)) as TrajectoryDbDataSet.pointsRow[]; if (rows != null) { BindingListCollectionView view = CollectionViewSource.GetDefaultView(rows) as BindingListCollectionView; pw.pointsDg.ItemsSource = rows; } //highlightRow(tid); } } }
private void BindingData() { WorkerProfCategoryCombobox.ItemsSource = _sc.GetTariffRates(); BindingWorkerProfFactoryComboBox(); BindingWorkerProfComboBox(); BindingWorkerProfGroupComboBox(); var workerProfessionsView = new BindingListCollectionView(_sc.GetWorkerProfessions()); workerProfessionsView.CustomFilter = string.Format("WorkerID = {0}", _workerId); workerProfessionsView.GroupDescriptions.Add(new PropertyGroupDescription("FactoryID")); WorkerProfessionsListBox.ItemsSource = workerProfessionsView; BindingAdditWorkerProfComboBox(); BindingAdditWorkerGroupComboBox(); var additionalWorkerProfessionsView = _sc.GetAdditionalWorkerProfessions(); additionalWorkerProfessionsView.RowFilter = string.Format("WorkerID = {0}", _workerId); AdditionalWorkerProfessionsListBox.ItemsSource = additionalWorkerProfessionsView; if (AdditionalWorkerProfessionsListBox.HasItems) { AdditionalWorkerProfessionsListBox.SelectedIndex = 0; } }
//{ //return Task.Run(async () => //{ // insideInitialization(); //}); //} protected virtual async void insideInitialization() { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { loadingIcon.RotateMe(); })); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed this.StatusString = "Запросил таблицу"; //Thread.Sleep(10000); this.DS = await RetrieveDS(); this.StatusString = "Получил таблицу."; for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { Filters.Add(ds.Tables[0].Columns[i].ColumnName.Substring(0, ds.Tables[0].Columns[i].ColumnName.IndexOf('>')), ""); } DS.Tables[0].RowChanging += DG_ViewModel_RowChanging; DS.Tables[0].RowDeleting += DG_ViewModel_RowDeleting; DS.Tables[0].ColumnChanging += DG_ViewModel_ColumnChanging; await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate() { BLCV = new BindingListCollectionView(DS.Tables[0].DefaultView); URM = new UndoRedoManager(DS.Tables[0]); loadingIcon.StopRotation(); })); }
private void WorkSubsectionsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (WorkSubsectionsListBox.SelectedItem == null || WorkSubsectionsListBox.SelectedValue == null) { prop3Grid.DataContext = null; WorkOperationsListBox.ItemsSource = null; AdittProp3StackPanel.DataContext = null; WorkOperationsListBox_SelectionChanged(null, null); return; } prop3Grid.DataContext = WorkSubsectionsListBox.SelectedItem; DataView operationsDataView = _cc.GetWorkOperations(); if (AdditOperationsChexkBox.IsChecked == true) { operationsDataView.RowFilter = String.Format("WorkSubsectionID IN ({0}, -1) AND Visible = True", WorkSubsectionsListBox.SelectedValue); var operationsCollectionView = new BindingListCollectionView(operationsDataView); if (operationsCollectionView.GroupDescriptions != null) { operationsCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("OperationTypeID", new OperationTypeConverter())); operationsCollectionView.SortDescriptions.Add(new SortDescription("OperationTypeID", ListSortDirection.Ascending)); WorkOperationsListBox.SelectionChanged -= WorkOperationsListBox_SelectionChanged; WorkOperationsListBox.ItemsSource = operationsCollectionView; WorkOperationsListBox.SelectionChanged += WorkOperationsListBox_SelectionChanged; } } else { operationsDataView.RowFilter = String.Format("WorkSubsectionID = {0} AND Visible = True", WorkSubsectionsListBox.SelectedValue); WorkOperationsListBox.SelectionChanged -= WorkOperationsListBox_SelectionChanged; WorkOperationsListBox.ItemsSource = operationsDataView; WorkOperationsListBox.SelectionChanged += WorkOperationsListBox_SelectionChanged; WorkOperationsListBox.Items.Refresh(); } WorkOperationsListBox.SelectedIndex = 0; WorkOperationsListBox.ScrollIntoView(WorkOperationsListBox.SelectedItem); WorkOperationsListBox_SelectionChanged(null, null); AdittProp3StackPanel.DataContext = Convert.ToInt32(((DataRowView)WorkSubsectionsListBox.SelectedItem)["SubsectionGroupID"]) == 2 ? _cc.GetMachineInfo(Convert.ToInt32(WorkSubsectionsListBox.SelectedValue)) : null; }
private void LoadShip() { if (ID == 0) { var Query = from n in db.schiffe select n; ViewSource.Source = new SchiffCollection(Query, db); View = (ListCollectionView)ViewSource.View; AggregateView = (BindingListCollectionView)AggregateViewSource.View; var i = (schiff)View.AddNew(); // i.name = "schiff Neu"; View.CommitNew(); bNew = true; } else { var Query = from n in db.schiffe where n.id == ID select n; ViewSource.Source = Query; AggregateView = (BindingListCollectionView)AggregateViewSource.View; } }
private void SetBindings() { if (_sc == null) { return; } var workersCollectionView = new BindingListCollectionView(_sc.FilterWorkers(true, 1, false, 0, false, 0).AsDataView()) { CustomFilter = "AvailableInList = 'True'" }; if (workersCollectionView.GroupDescriptions != null) { workersCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Name", new FirstLetterConverter())); workersCollectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); UsersComboBox.SelectionChanged -= UsersComboBox_SelectionChanged; UsersComboBox.ItemsSource = workersCollectionView; UsersComboBox.SelectedItem = null; UsersComboBox.SelectionChanged += UsersComboBox_SelectionChanged; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Fill the Customers table adapter with data. this.customersTableAdapter.ClearBeforeFill = true; this.customersTableAdapter.Fill(this.nwDataSet.Customers); // Fill the Orders table adapter with data. this.ordersTableAdapter.Fill(this.nwDataSet.Orders); // Assign the BindingSource to // the data context of the main grid. this.mainGrid.DataContext = this.nwBindingSource; // Assign the BindingSource to // the data source of the list box. this.listBox1.ItemsSource = this.nwBindingSource; // Because this is a master/details form, the DataGridView // requires the foreign key relating the tables. this.dataGridView1.DataSource = this.nwBindingSource; this.dataGridView1.DataMember = "FK_Orders_Customers"; // Handle the currency management aspect of the data models. // Attach an event handler to detect when the current item // changes via the WPF ListBox. This event handler synchronizes // the list collection with the BindingSource. // BindingListCollectionView cv = CollectionViewSource.GetDefaultView( this.nwBindingSource) as BindingListCollectionView; cv.CurrentChanged += new EventHandler(WPF_CurrentChanged); }
private void LoadShip() { if (ID == 0) { var Query = from n in db.StammZahlungsbedingungen select n; ViewSource.Source = new ZahlungsbedingungCollection(Query, db); View = (ListCollectionView)ViewSource.View; ZBView = (BindingListCollectionView)ZBViewSource.View; ZBSprachenView = (BindingListCollectionView)ZB_SprachenViewSource.View; var i = (StammZahlungsbedingungen)View.AddNew(); // i.name = "schiff Neu"; View.CommitNew(); bNew = true; this.ZahlungsbedingungenSprachenGrid.IsEnabled = false; } else { var Query = from n in db.StammZahlungsbedingungen where n.id == ID select n; ViewSource.Source = Query; ZBView = (BindingListCollectionView)ZBViewSource.View; ZBSprachenView = (BindingListCollectionView)ZB_SprachenViewSource.View; } }
//Load Data, always call on activation! public bool LoadServiceData(CarModel car) { _car = car; _serviceList = DataAccess.GetServices(car.CarID); // load up Services from DB if (_serviceList is null) { return(false); } foreach (ServiceModel SM in _serviceList) { SM.RecalcCost(); } _serviceList.Sort(); //Binding _services = new BindingList <ServiceModel>(_serviceList); _services.RaiseListChangedEvents = true; _sortedServices = new BindingListCollectionView(_services); _sortedServices.MoveCurrentToFirst(); _fieldedService = _sortedServices.CurrentItem as ServiceModel; NotifyOfPropertyChange(() => SortedServices); NotifyOfPropertyChange(() => CanDelete); return(true); }
private void BindServiceLineList() { //Binding detail lines _blServiceLines = new BindingList <ServiceLineModel>(FieldedService.ServiceLineList); // _blServiceLines.RaiseListChangedEvents = true; _cvServiceLines = new BindingListCollectionView(_blServiceLines); }
private void Run_Click(object sender, RoutedEventArgs e) { // db = new SteinbachEntities(); ProjektViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("Projekt_ViewSource"))); var ProjektQuery = ProjektRepo.GetProjekteByID(CurrentProjektID); ProjektViewSource.Source = ProjektQuery; ProjektView = (ListCollectionView)ProjektViewSource.View; projekt p = (projekt)ProjektView.CurrentItem; var PersonLookup = ((System.Windows.Data.CollectionViewSource)(this.FindResource("PersonLookUp"))); var query = from pers in db.personen select pers; PersonLookup.Source = query; VerlaufViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ProjektVerlauf_ViewSource"))); VerlaufView = (BindingListCollectionView)(VerlaufViewSource.View); AnlagenTypViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("AnlagenTyp_ViewSource"))); AnlagenTypView = (BindingListCollectionView)(AnlagenTypViewSource.View); ProjektView.CurrentChanged += new EventHandler(ProjektView_CurrentChanged); }
void Changing() { try { BindingListCollectionView view = CollectionViewSource.GetDefaultView(dgMain.ItemsSource) as BindingListCollectionView; if (view != null) { view.CustomFilter = ""; view.CustomFilter = string.Format("FamilyCode like '%{0}%'", txtFamilyCode.Text); if (!string.IsNullOrEmpty(txtFamilyName.Text)) { view.CustomFilter += string.Format(" and FamilyName like '%{0}%'", txtFamilyName.Text); } if (cmboFamilyType.SelectedIndex > 0) { view.CustomFilter += string.Format(" and FamilyType like '{0}'", (cmboFamilyType.Items[cmboFamilyType.SelectedIndex] as ComboBoxItem).Content); } if (!string.IsNullOrEmpty(txtListerName.Text)) { view.CustomFilter += string.Format(" and ListerName like '%{0}%'", txtListerName.Text); } if (cmboGender.SelectedIndex > 0) { view.CustomFilter += string.Format(" and Gender like '{0}'", cmboGender.SelectedItem); } if (cmboEvaluation.SelectedIndex > 0) { view.CustomFilter += string.Format(" and Evaluation like '{0}'", cmboEvaluation.SelectedItem); } if (dtpDate1.SelectedDate != null) { view.CustomFilter += string.Format(" and Date >= #{0}#", ((DateTime)dtpDate1.SelectedDate).ToString("MM/dd/yyyy")); } if (dtpDate2.SelectedDate != null) { view.CustomFilter += string.Format(" and Date <= #{0}#", ((DateTime)dtpDate2.SelectedDate).ToString("MM/dd/yyyy")); } if (dtpApplyDate1.SelectedDate != null) { view.CustomFilter += string.Format(" and ApplyDate >= #{0}#", ((DateTime)dtpApplyDate1.SelectedDate).ToString("MM/dd/yyyy")); } if (dtpApplyDate2.SelectedDate != null) { view.CustomFilter += string.Format(" and ApplyDate <= #{0}#", ((DateTime)dtpApplyDate2.SelectedDate).ToString("MM/dd/yyyy")); } if (dtpCreateDate1.SelectedDate != null) { view.CustomFilter += string.Format(" and CreateDate >= #{0}#", ((DateTime)dtpCreateDate1.SelectedDate).ToString("MM/dd/yyyy")); } if (dtpCreateDate2.SelectedDate != null) { view.CustomFilter += string.Format(" and CreateDate <= #{0}#", ((DateTime)dtpCreateDate2.SelectedDate).ToString("MM/dd/yyyy")); } FieldCount = view.Count; } } catch { } }
private void cmdRemoveFilter_Click(object sender, RoutedEventArgs e) { view = CollectionViewSource.GetDefaultView(lstProducts.ItemsSource) as BindingListCollectionView; if (view != null) { view.Filter = null; } }
private void cmdGetProducts_Click(object sender, RoutedEventArgs e) { products = App.StoreDbDataSet.GetProducts(); lstProducts.ItemsSource = products.DefaultView; view = CollectionViewSource.GetDefaultView(lstProducts.ItemsSource) as BindingListCollectionView; view.SortDescriptions.Add(new System.ComponentModel.SortDescription("ModelName", System.ComponentModel.ListSortDirection.Ascending)); }
public UserProgramsControl() { InitHelper.InitTimer(this, InitializeComponent); ListPanel.MainDataGrid.SelectionChanged += MainDataGrid_SelectionChanged; var userGamesView = new BindingListCollectionView(SettingsManager.UserGames.Items); ListPanel.MainDataGrid.ItemsSource = userGamesView; }
public void FilterCustomerByOrganizationNo(string organizationNo) { BindingListCollectionView view2 = CollectionViewSource.GetDefaultView(this.customerData.customer) as BindingListCollectionView; if (view2 != null) { view2.CustomFilter = "organization_no = '" + organizationNo + "'"; } }
public void FilterSurchargesByOrganizationNo(string organizationNo) { BindingListCollectionView view1 = CollectionViewSource.GetDefaultView(surchargeData.surcharge) as BindingListCollectionView; if (view1 != null) { view1.CustomFilter = "organization_no = '" + organizationNo + "'"; } }
private void FilterItems(object sender, RoutedEventArgs args) { BindingListCollectionView view = (BindingListCollectionView)CollectionViewSource.GetDefaultView(ds.Tables["Mountains"]); //bool canFilter = view.CanFilter; // false //bool canCustomFilter = view.CanCustomFilter; // true view.CustomFilter = "Mountain_Name <> 'Crystal Mountain'"; }
public void FilterItemGroupDByOrganizationNo(string organizationNo) { BindingListCollectionView view1 = CollectionViewSource.GetDefaultView(this.groupData.ItemGroup) as BindingListCollectionView; if (view1 != null) { view1.CustomFilter = "organization_no = '" + organizationNo.ToString() + "'"; } }
public void FilterCurrencyByOrganizationNo(int organizationNo) { BindingListCollectionView view2 = CollectionViewSource.GetDefaultView(this.currencyData.currency) as BindingListCollectionView; if (view2 != null) { view2.CustomFilter = "organization_no = " + organizationNo.ToString(); } }