当前位置: 首页>>代码示例>>C#>>正文


C# ICollectionView.Refresh方法代码示例

本文整理汇总了C#中ICollectionView.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ICollectionView.Refresh方法的具体用法?C# ICollectionView.Refresh怎么用?C# ICollectionView.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICollectionView的用法示例。


在下文中一共展示了ICollectionView.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LibraryWindowViewModel

        public LibraryWindowViewModel() 
        {
            view = CollectionViewSource.GetDefaultView(LibraryItems);

            LibraryItems = new System.Collections.ObjectModel.ObservableCollection<string>(iservice.Files);
            iservice.Start();
            iservice.FilesUpdated += new EventHandler<EventArgs<IList<string>>>(iservice_FilesUpdated);

            this.PropertyChanged += (s, ea) => 
                System.Diagnostics.Debug.WriteLine(ea.PropertyName + " changed to " + 
                    this.GetType().GetProperty(ea.PropertyName).GetValue(this,null));

            Observable.FromEventPattern<System.ComponentModel.PropertyChangedEventArgs>(this, "PropertyChanged")
                .Where(et => et.EventArgs.PropertyName == "SearchString")
                .Throttle(TimeSpan.FromMilliseconds(250))
                .Subscribe(_ => {
                    System.Diagnostics.Debug.WriteLine("search string changed");
                    
                    if (SearchString.Trim() == string.Empty)
                        view.Filter = null;
                    else
                        view.Filter = o => Regex.IsMatch(o as string, SearchString, RegexOptions.IgnoreCase);
                        
                    view.Refresh();
                    FilteredLibraryItemsCount = LibraryItems.Where(o => Regex.IsMatch(o as string, SearchString, RegexOptions.IgnoreCase)).Count();
                });

            //Observable.FromEventPattern<System.ComponentModel.PropertyChangedEventArgs>(this, "PropertyChanged")
            //    .Where(et => et.EventArgs.PropertyName == "LibraryItems")
            //    .Do(et => view = CollectionViewSource.GetDefaultView(LibraryItems));
            
            

        }
开发者ID:jrwren,项目名称:XBMCRemote,代码行数:34,代码来源:LibraryWindow.xaml.cs

示例2: TextSearchFilter

        public TextSearchFilter(
            ICollectionView filterView,
            TextBox textbox)
        {
            string filterText = "";

            filterView.Filter = delegate(object obj)
            {
                if (String.IsNullOrEmpty(filterText))
                    return true;

                Stream stream = obj as Stream;
                if (stream == null)
                    return false;

                String streamText = stream.Title + stream.Genre + stream.Description;

                int index = streamText.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);

                return index > -1;
            };

            textbox.TextChanged += delegate
            {
                filterText = textbox.Text;
                filterView.Refresh();
            };
        }
开发者ID:mhack,项目名称:gamenoise,代码行数:28,代码来源:TextSearchFilter.cs

示例3: TextFilter

        public TextFilter(ICollectionView filteredView, TextBox box)
        {
            string filterText = "";

            filteredView.Filter = delegate(object obj)
            {
                if (string.IsNullOrEmpty(filterText))
                    return true;

                string str = obj as string;

                if (obj is IFilterable)
                    str = ((IFilterable)obj).FilterString;

                if (string.IsNullOrEmpty(str))
                    return false;

                return str.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase) >= 0;
            };

            box.TextChanged += delegate {
                filterText = box.Text;
                filteredView.Refresh();
            };
        }
开发者ID:Quit,项目名称:Jofferson,代码行数:25,代码来源:TextFilter.cs

示例4: CustomerInfoSearch

        public CustomerInfoSearch(ICollectionView filteredList, TextBox textEdit)
        {
            string filterText = string.Empty;

            filteredList.Filter = delegate(object obj)
            {
                if (String.IsNullOrEmpty(filterText))
                {
                    return true;
                }
                ModelCustomer str = obj as ModelCustomer;
                if (str.UserName==null)
                {
                    return true;
                }
                if (str.UserName.ToUpper().Contains(filterText.ToUpper()))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            };
            textEdit.TextChanged += delegate
            {
                filterText = textEdit.Text;
                filteredList.Refresh();
            };
        }
开发者ID:shuvo009,项目名称:CafeteriaVernier,代码行数:30,代码来源:CustomerInfoSearch.cs

示例5: 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

示例6: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            Status = new HashSet<Status>();
            listBox.ItemsSource = Status;

            View = CollectionViewSource.GetDefaultView(Status);
            View.SortDescriptions.Add(new SortDescription("CreatedAt.LocalDateTime", ListSortDirection.Descending));

            var liveShaping = View as ICollectionViewLiveShaping;

            if (liveShaping != null && liveShaping.CanChangeLiveSorting)
            {
                liveShaping.LiveSortingProperties.Add("CreatedAt.LocalDateTime");
                liveShaping.IsLiveSorting = true;
            }

            if (Properties.Settings.Default.AccessToken != "" &&
                Properties.Settings.Default.AccessTokenSecret != "")
            {
                Tokens = Tokens.Create(
                    TwitterProperties.APIKey,
                    TwitterProperties.APISecret,
                    Properties.Settings.Default.AccessToken,
                    Properties.Settings.Default.AccessTokenSecret);

                GetHomeTimeLineAsync();

                StreamingDisposable = Tokens.Streaming.UserAsObservable()
                    .Where((StreamingMessage m) => m.Type == MessageType.Create)
                    .Cast<StatusMessage>()
                    .Select((StatusMessage m) => m.Status)
                    .Subscribe((Status tweet) =>
                    {
                        Application.Current.Dispatcher.Invoke(
                            new Action(() =>
                            {
                                if (Status.Contains(tweet)) return;
                                Status.Add(TweetProcessing(tweet));
                                var selectIndex = listBox.SelectedIndex;
                                if (selectIndex != 0) selectIndex++;
                                View.Refresh();
                                listBox.SelectedIndex = selectIndex;
                                listBox.ScrollIntoView(listBox.SelectedItem);
                                //カーソルでの位置固定
                                var lbi = listBox.ItemContainerGenerator.ContainerFromIndex(selectIndex) as ListBoxItem;
                                lbi?.Focus();
                            })
                        );
                        
                    });
            }
            else
            {
                var OauthWindow = new OauthWindow();
                OauthWindow.Show();
                Close();
            }
        }
开发者ID:meronmks,项目名称:WPFTweetApp-WIP-,代码行数:59,代码来源:MainWindow.xaml.cs

示例7: add_Playlist

 private void add_Playlist(MediaContent content)
 {
     _PlaylistList.Add(content._Titre);
     if (global == true)
     {
         librarylist.Add(content);
         _LibraryList = CollectionViewSource.GetDefaultView(librarylist);
         _LibraryList.Refresh();
     }
 }
开发者ID:Haseo,项目名称:project-WMP,代码行数:10,代码来源:LibraryViewModel.cs

示例8: delete_Playlist

 public void delete_Playlist(int index)
 {
     if (index >= 0 && index < _PlaylistList.Count)
         _PlaylistList.RemoveAt(index);
     if (global == true && index >= 0 && index < librarylist.Count)
     {
         librarylist.RemoveAt(index);
         _LibraryList = CollectionViewSource.GetDefaultView(librarylist);
         _LibraryList.Refresh();
     }
 }
开发者ID:Haseo,项目名称:project-WMP,代码行数:11,代码来源:LibraryViewModel.cs

示例9: readXml

        public static void readXml(string path)
        {
            _itemView.Filter = filter;
            items.Clear();
            _filterString = "";
            _itemView = CollectionViewSource.GetDefaultView(items);
            _itemView.Filter = filter;

            XmlDocument doc = new XmlDocument();
            doc.Load(path);
            XmlNode root = doc.FirstChild;
            foreach (XmlNode n in root.ChildNodes)
            {
                items.Add(new Book(n));
            }
            _itemView.Refresh();
        }
开发者ID:regalcat,项目名称:LoanShark,代码行数:17,代码来源:Database.cs

示例10: FalconKeyCallbackFilter

        public FalconKeyCallbackFilter(ICollectionView filteredView, TextBox textBox)
        {
            string filterText = "";
            if (filteredView != null)
            {
                filteredView.Filter = delegate(object obj)
                {
                    if (String.IsNullOrEmpty(filterText))
                        return true;

                    FalconKeyCallback callback = obj as FalconKeyCallback;
                    int nameIndex = callback.Name.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
                    int descIndex = callback.Description.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
                    return nameIndex > -1 || descIndex > -1;
                };

                textBox.TextChanged += delegate
                {
                    filterText = textBox.Text;
                    filteredView.Refresh();
                };
            }
        }
开发者ID:Heliflyer,项目名称:helios,代码行数:23,代码来源:FalconKeyCallbackFilter.cs

示例11: AccountRechargeSearchs

 public AccountRechargeSearchs(ICollectionView filteredList, TextBox textEdit)
 {
     string filterText = string.Empty;
     string properyText = string.Empty;
     filteredList.Filter = delegate(object obj)
     {
         if (String.IsNullOrEmpty(filterText))
         {
             return true;
         }
         if (obj is ModelCustomer)
         {
             properyText = (obj as ModelCustomer).Name;
         }
         if (obj is ModelTeamInfo)
         {
             properyText = (obj as ModelTeamInfo).Name;
         }
         if (String.IsNullOrEmpty(properyText))
         {
             return true;
         }
         if (properyText.ToUpper().Contains(filterText.ToUpper()))
         {
             return true;
         }
         else
         {
             return false;
         }
     };
     textEdit.TextChanged += delegate
     {
         filterText = textEdit.Text;
         filteredList.Refresh();
     };
 }
开发者ID:shuvo009,项目名称:CafeteriaVernier,代码行数:37,代码来源:AccountRechargeSearchs.cs

示例12: UpdateClilocs

        private void UpdateClilocs()
        {
            if ( _View != null )
                _View.Filter -= new Predicate<object>( Filter_Displayed );

            UltimaStringCollection clilocs = Clilocs;

            if ( clilocs == null )
            {
                _View = null;
                return;
            }

            _View = CollectionViewSource.GetDefaultView( clilocs.List );

            if ( _View != null )
            {
                _View.Filter += new Predicate<object>( Filter_Displayed );
                _View.Refresh();
            }
        }
开发者ID:Ben1028,项目名称:SpyUO,代码行数:21,代码来源:ClilocWindow.xaml.cs

示例13: CreateCollectionViewSource

 private void CreateCollectionViewSource()
 {
     CollectionViewSource collectionViewSource = new CollectionViewSource();
     collectionViewSource.GroupDescriptions.Add(new PropertyGroupDescription("ChangeDate"));
     collectionViewSource.SortDescriptions.Add(new SortDescription("ChangeDate", ListSortDirection.Descending));
     collectionViewSource.Source = _allChanges;
     _allChangesCollectionView = collectionViewSource.View;
     _allChangesCollectionView.Refresh();
 }
开发者ID:markusl,项目名称:jro,代码行数:9,代码来源:ChangelogViewModel.cs

示例14: UpdateGroupedDevices

		void UpdateGroupedDevices()
		{
			foreach (DestinationOSDeviceInfo driver in allDrivers.DownloadedDestinationOSDrivers)
			{
				DestinationOSDevicesGroup destinationOSDevicesGroup = GroupedDevices.Where(g => g.DeviceClass == driver.DeviceClass).FirstOrDefault();
				if (destinationOSDevicesGroup == null)
				{
					GroupedDevices.Add(new DestinationOSDevicesGroup(driver.DeviceClass, driver.DeviceClassName, driver.DeviceClassImageSmall, new List<DestinationOSDeviceInfo> { driver }));
				}
				else
				{
					destinationOSDevicesGroup.Drivers.Add(driver);
				}
			}

			OrderedDeviceGroups = CollectionViewSource.GetDefaultView(GroupedDevices);
			OrderedDeviceGroups.SortDescriptions.Clear();
			OrderedDeviceGroups.SortDescriptions.Add(new SortDescription("Order", ListSortDirection.Ascending));
			OrderedDeviceGroups.Refresh();
		}
开发者ID:nullkuhl,项目名称:fdu-dev,代码行数:20,代码来源:MainWindowViewModel.cs

示例15: add_libraryList

 private void add_libraryList(MediaContent content)
 {
     librarylist.Add(content);
     _LibraryList = CollectionViewSource.GetDefaultView(librarylist);
     _LibraryList.Refresh();
 }
开发者ID:Haseo,项目名称:project-WMP,代码行数:6,代码来源:LibraryViewModel.cs


注:本文中的ICollectionView.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。