當前位置: 首頁>>代碼示例>>C#>>正文


C# ComponentModel.SortDescription類代碼示例

本文整理匯總了C#中System.ComponentModel.SortDescription的典型用法代碼示例。如果您正苦於以下問題:C# SortDescription類的具體用法?C# SortDescription怎麽用?C# SortDescription使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SortDescription類屬於System.ComponentModel命名空間,在下文中一共展示了SortDescription類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ContactViewModel

        public ContactViewModel(BusinessCoreService businessCoreService, ConversationViewModel conversation)
        {
            _businessCoreService = businessCoreService;
            _conversation = conversation;
            IsSelected = false;

            CvsStaff = new CollectionViewSource { Source = _businessCoreService.GetContacts() };
            GroupDescription gp = new PropertyGroupDescription("OrganizationId");
            SortDescription sp = new SortDescription("OrganizationId", ListSortDirection.Ascending);
            CvsStaff.GroupDescriptions.Add(gp);
            CvsStaff.SortDescriptions.Add(sp);
     
            CvsStaff.Filter += ApplyFilter;

            var treeSource = _businessCoreService.GetOrganizationTreeNoChildren();
            var data = new ObservableCollection<OrganizationTreeInfoViewModel>();
            foreach (var item in treeSource)
            {
                data.Add(new OrganizationTreeInfoViewModel(item, _businessCoreService));
            }

            var result = GetOrganizationTree(data.Where(x => x.Info.ParentId == null).ToList(), data);
            _organizationTreeSource = new ObservableCollection<OrganizationTreeInfoViewModel>(result);
            OrganizationTreeCvsStaff = new CollectionViewSource { Source = _organizationTreeSource };

            Subscription.DoSelectedTree(SelectedUsersCallback);
        }
開發者ID:GavinHome,項目名稱:REVOLUTION,代碼行數:27,代碼來源:ContactViewModel.cs

示例2: Sort

 public static void Sort(ItemsControl listView, string sortBy, ListSortDirection direction)
 {
     listView.Items.SortDescriptions.Clear();
     var sd = new SortDescription(sortBy, direction);
     listView.Items.SortDescriptions.Add(sd);
     listView.Items.Refresh();
 }
開發者ID:naeemkhedarun,項目名稱:ShoutcastBrowser,代碼行數:7,代碼來源:GridViewColumnSorter.cs

示例3: Sort

        private void Sort(string sortBy, ListSortDirection direction)
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_log.DataContext);

                dataView.SortDescriptions.Clear();

                SortDescription sd = new SortDescription(sortBy, direction);
                dataView.SortDescriptions.Add(sd);
                if (_lastHeaderClicked2 != null)
                {
                    if (String.Compare(sortBy, _lastHeaderClicked2) != 0)
                    {
                        SortDescription sd2 = new SortDescription(_lastHeaderClicked2, _lastDirection2);
                        dataView.SortDescriptions.Add(sd2);
                    }
                }
                dataView.Refresh();

                Settings.Instance.ResColumnHead = sortBy;
                Settings.Instance.ResSortDirection = direction;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
開發者ID:lokippc,項目名稱:EDCB,代碼行數:29,代碼來源:NotifyLogWindow.xaml.cs

示例4: SetupSyncObjectViewModelsView

 private void SetupSyncObjectViewModelsView()
 {
     this.SyncObjectViewModelsView = new ListCollectionView( this._syncObjectVMs );
     var displayNameSorting = new SortDescription( "Model.DisplayName", ListSortDirection.Ascending );
     this.SyncObjectViewModelsView.SortDescriptions.Add( displayNameSorting );
     this.SyncObjectViewModelsView.Filter = this.SyncObjectViewModelsView_Filter;
 }
開發者ID:XElementSoftware,項目名稱:CloudSyncHelper,代碼行數:7,代碼來源:ViewModel.cs

示例5: PageAirportFacilities

        public PageAirportFacilities(AirportMVVM airport)
        {
            Airport = airport;
            DataContext = Airport;

            FacilityTypes =
                Enum.GetValues(typeof(AirportFacility.FacilityType)).Cast<AirportFacility.FacilityType>().ToList();

            if (!airport.Airport.Terminals.AirportTerminals.Exists(t => t.Type == Terminal.TerminalType.Cargo))
                FacilityTypes.Remove(AirportFacility.FacilityType.Cargo);

            InitializeComponent();

            var view = (CollectionView)CollectionViewSource.GetDefaultView(lbFacilities.ItemsSource);
            view.SortDescriptions.Clear();

            var sortAirlineDescription = new SortDescription(
                "Facility.Airline.Profile.Name",
                ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortAirlineDescription);

            var sortFacilityDescription = new SortDescription(
                "Facility.Facility.Shortname",
                ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortFacilityDescription);
        }
開發者ID:TheAirlineProject,項目名稱:tap-desktop,代碼行數:26,代碼來源:PageAirportFacilities.xaml.cs

示例6: SortOrderCombo_OnSelectionChanged

        private void SortOrderCombo_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem cbi = e.AddedItems[0] as ComboBoxItem;
            if (cbi != null)
            {
                string newSortOrder;
                if (cbi.Tag == null)
                {
                    newSortOrder = "None";
                }
                else
                {
                    newSortOrder = cbi.Tag.ToString();
                }

                SortDescription sortDesc = new SortDescription(newSortOrder, ListSortDirection.Ascending);
                ICollectionView cv = CollectionViewSource.GetDefaultView(DataContext);

                if (cv != null)
                {
                    cv.SortDescriptions.Clear();
                    if (newSortOrder != "None")
                        cv.SortDescriptions.Add(sortDesc);
                    {

                    }
                }
            }
        }
開發者ID:AlexJCarstensen,項目名稱:AgentsPart3-I4GUI,代碼行數:29,代碼來源:MainWindow.xaml.cs

示例7: NewUserRegistration

        public NewUserRegistration()
        {
            InitializeComponent();
            this.contactsCollection = new System.Windows.Data.CollectionViewSource();

            this.contactsCollection.Source = ((NewUserRegistrationViewModel)this.DataContext).RegisteredUsers;
            System.ComponentModel.SortDescription contactsSort = new System.ComponentModel.SortDescription("FirstLetter", System.ComponentModel.ListSortDirection.Ascending);
            this.contactsCollection.SortDescriptions.Add(contactsSort);
            BackgroundWorker worker = new BackgroundWorker();
            DispatcherHelper.InvokeOnUiThread(() =>
                {
                    NewUserRegistration.InitializeDictionaries();
                    RegionInfo region = RegionInfo.CurrentRegion;
                    this.CountryCodeListPicker.ItemsSource = NewUserRegistration.CountryNameToCode.Keys.ToArray();
                    if (NewUserRegistration.CountryNameToCode.ContainsKey(region.TwoLetterISORegionName))
                    {
                        this.CountryCodeListPicker.SelectedItem = (string)NewUserRegistration.CountryNameToCode[region.TwoLetterISORegionName];
                    }
                    else
                    {
                        this.CountryCodeListPicker.SelectedItem = (string)NewUserRegistration.CodeToCountry["US"];
                    }
                },
                true);

            worker.RunWorkerAsync();
        }
開發者ID:nrag,項目名稱:yapper,代碼行數:27,代碼來源:NewUserRegistrationView.xaml.cs

示例8: RestoreSorting

        public static void RestoreSorting(DataGridSortDescription sortDescription, DataGrid grid, ICollectionView view)
        {
            if (sortDescription.SortDescription != null && sortDescription.SortDescription.Count == 0)
            {
                if (Core.Settings.Default.CacheListEnableAutomaticSorting)
                {
                    if (Core.Settings.Default.CacheListSortOnColumnIndex >= 0 && Core.Settings.Default.CacheListSortOnColumnIndex < grid.Columns.Count)
                    {
                        SortDescription sd = new SortDescription(grid.Columns[Core.Settings.Default.CacheListSortOnColumnIndex].SortMemberPath, Core.Settings.Default.CacheListSortDirection == 0 ? ListSortDirection.Ascending : ListSortDirection.Descending);
                        sortDescription.SortDescription.Add(sd);
                    }
                }
            }
            //restore the column sort order
            if (sortDescription.SortDescription != null && sortDescription.SortDescription.Count > 0)
            {
                sortDescription.SortDescription.ToList().ForEach(x => view.SortDescriptions.Add(x));
                view.Refresh();
            }

            //restore the sort directions. Arrows are nice :)
            foreach (DataGridColumn c in grid.Columns)
            {
                if (sortDescription.SortDirection.ContainsKey(c))
                {
                    c.SortDirection = sortDescription.SortDirection[c];
                }
            }
        }
開發者ID:gahadzikwa,項目名稱:GAPP,代碼行數:29,代碼來源:DataGridUtil.cs

示例9: OrderByLastName

 private void OrderByLastName(ListSortDirection dir)
 {
     ICollectionView dataView = CollectionViewSource.GetDefaultView(testListView.ItemsSource);
     dataView.SortDescriptions.Clear();
     SortDescription sd = new SortDescription("LastName", dir);
     dataView.SortDescriptions.Add(sd);
     dataView.Refresh();
 }
開發者ID:powernick,項目名稱:CodeLib,代碼行數:8,代碼來源:TestListView.xaml.cs

示例10: Convert

        /// <summary>
        /// Converts a value.
        /// </summary>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            IList collection = value as System.Collections.IList;
            ListCollectionView view = new ListCollectionView(collection);
            SortDescription sort = new SortDescription(parameter.ToString(), ListSortDirection.Ascending);
            view.SortDescriptions.Add(sort);

            return view;
        }
開發者ID:NuPattern,項目名稱:NuPattern,代碼行數:12,代碼來源:TreeViewItemOrderingConverter.cs

示例11: Sort

        private void Sort(string sortBy, ListSortDirection direction)
        {
            ICollectionView dataView = CollectionViewSource.GetDefaultView(TrackList.ItemsSource);

            dataView.SortDescriptions.Clear();
            SortDescription sd = new SortDescription(sortBy, direction);
            dataView.SortDescriptions.Add(sd);
            dataView.Refresh();
        }
開發者ID:InevitableHimes,項目名稱:RSTabExplorer,代碼行數:9,代碼來源:TrackListing.xaml.cs

示例12: SetNewSortOrder

        private void SetNewSortOrder()
        {
            string newSortOrder = ((ComboBoxItem)sortOrderCombo.SelectedItem).Content.ToString();
            SortDescription sortDesc = new SortDescription(newSortOrder, ListSortDirection.Ascending);

            CollectionViewSource src = (CollectionViewSource)FindResource("processesView");
            src.SortDescriptions.Clear();
            src.SortDescriptions.Add(sortDesc);
        }
開發者ID:ngbrown,項目名稱:WPFinAction,代碼行數:9,代碼來源:Monitor.xaml.cs

示例13: PageAirlineServices

        public PageAirlineServices(AirlineMVVM airline)
        {
            this.Classes = new ObservableCollection<AirlineClassMVVM>();

            foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    AirlineClassMVVM rClass = new AirlineClassMVVM(type);

                    foreach (RouteFacility.FacilityType facilityType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (GameObject.GetInstance().GameTime.Year >= (int)facilityType)
                        {
                            AirlineClassFacilityMVVM facility = new AirlineClassFacilityMVVM(facilityType);

                            facility.Facilities.Clear();

                            foreach (RouteFacility rFacility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, facilityType))
                                facility.Facilities.Add(rFacility);

                            facility.SelectedFacility = RouteFacilities.GetBasicFacility(facility.Type);//GetFacilities(rFacility.Type).OrderBy(f => f.ServiceLevel).First();

                            rClass.Facilities.Add(facility);
                        }
                    }
                    this.Classes.Add(rClass);
                }
            }

            this.Airline = airline;
            this.DataContext = this.Airline;
            this.Loaded += PageAirlineServices_Loaded;

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFacilities.ItemsSource);
            view.GroupDescriptions.Clear();
            view.SortDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");
            view.GroupDescriptions.Add(groupDescription);

            SortDescription sortTypeDescription = new SortDescription("Type", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortTypeDescription);

            SortDescription sortFacilityDescription = new SortDescription("Facility.Name", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortFacilityDescription);

            for (int i = 120; i < 300; i += 15)
                cbCancellationPolicy.Items.Add(i);

            cbCancellationPolicy.SelectedItem = this.Airline.Airline.getAirlinePolicy("Cancellation Minutes").PolicyValue;
        }
開發者ID:tehknox,項目名稱:tap-desktop,代碼行數:54,代碼來源:PageAirlineServices.xaml.cs

示例14: SortList

        /// <summary>
        /// Sort the data.
        /// </summary>
        private void SortList(string propertyName)
        {
            // Get the data to sort.
            ICollectionView dataView = CollectionViewSource.GetDefaultView(this.ItemsSource);

            // Specify the new sorting information.
            dataView.SortDescriptions.Clear();
            SortDescription description = new SortDescription(propertyName, sortDirection);
            dataView.SortDescriptions.Add(description);

            dataView.Refresh();
        }
開發者ID:CraigCary,項目名稱:roduino,代碼行數:15,代碼來源:SortListView.cs

示例15: LogitemsViewHeaderClicked

 private void LogitemsViewHeaderClicked(object sender, RoutedEventArgs e)
 {
     var header = e.OriginalSource as GridViewColumnHeader;
     if (null == header) { return; }
     var source = (ListView)e.Source;
     var nameOfHeader = header.Content.ToString();
     var dataView = CollectionViewSource.GetDefaultView(source.ItemsSource);
     dataView.SortDescriptions.Clear();
     _direction = _direction == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
     var description = new SortDescription(nameOfHeader, _direction);
     dataView.SortDescriptions.Add(description);
     dataView.Refresh();
 }
開發者ID:wallymathieu,項目名稱:log4net-logviewer,代碼行數:13,代碼來源:LogListView.xaml.cs


注:本文中的System.ComponentModel.SortDescription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。