当前位置: 首页>>代码示例>>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;未经允许,请勿转载。