本文整理汇总了C#中ICollectionView类的典型用法代码示例。如果您正苦于以下问题:C# ICollectionView类的具体用法?C# ICollectionView怎么用?C# ICollectionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICollectionView类属于命名空间,在下文中一共展示了ICollectionView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TextSearchFilter
public TextSearchFilter(ICollectionView filteredView, TextBox textBox)
{
string filterText = "";
/* filteredView.Filter = delegate(object obj)
{
if (string.IsNullOrEmpty(filterText))
return true;
string str = obj as string;
if (string.IsNullOrEmpty(str))
return false;
int index = str.IndexOf(filterText, 0, StringComparison.CurrentCultureIgnoreCase);
return index > -1;
};
textBox.TextChanged += delegate
{
filterText = textBox.Text;
filteredView.Refresh();
};**/
}
开发者ID:RefMashao,项目名称:InformationalApp,代码行数:26,代码来源:TextSearchFilter.cs
示例2: 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
示例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: RemoveHandler
/// <summary>
/// Remove a handler for the given source's event.
/// </summary>
public static void RemoveHandler(ICollectionView source, EventHandler<CurrentChangingEventArgs> handler)
{
if (handler == null)
throw new ArgumentNullException("handler");
CurrentManager.ProtectedRemoveHandler(source, handler);
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:10,代码来源:CurrentChangingEventManager.cs
示例5: CollectionViewGroupRoot
// Methods
internal CollectionViewGroupRoot(ICollectionView view, bool isDataInGroupOrder)
: base("Root", null)
{
this._groupBy = new ObservableCollection<GroupDescription>();
this._view = view;
this._isDataInGroupOrder = isDataInGroupOrder;
}
开发者ID:ssickles,项目名称:archive,代码行数:8,代码来源:CollectionViewGroupRoot.cs
示例6: SelectAllItems
public void SelectAllItems(ICollectionView availableItemsCollectionView)
{
if (availableItemsCollectionView.SourceCollection is ICollection<Store>)
{
availableItemsCollectionView.Cast<Store>().ToList().ForEach(x => SelectItem(x));
}
}
开发者ID:Wdovin,项目名称:vc-community,代码行数:7,代码来源:StoreLinkedStoresStepViewModel.cs
示例7: TextFilterMucAffs
public TextFilterMucAffs(ICollectionView[] collectionViews, TextBox textBox)
: this()
{
string filterText = String.Empty;
_collectionViews = collectionViews;
foreach (ICollectionView collectionView in _collectionViews)
{
collectionView.Filter = delegate(object obj)
{
MucAffContact mucAffContact = obj as MucAffContact;
if (mucAffContact == null || string.IsNullOrEmpty(mucAffContact.Jid))
{
return false;
}
return
mucAffContact.Jid.IndexOf(filterText, 0, StringComparison.CurrentCultureIgnoreCase) >= 0;
};
textBox.TextChanged += delegate
{
filterText = textBox.Text;
_keyTime.Start();
};
}
}
开发者ID:erpframework,项目名称:xeus-messenger2,代码行数:29,代码来源:TextFilterMucAffs.cs
示例8: FilterRoster
public FilterRoster(ICollectionView collectionView, TextBox searchBox)
{
_collectionView = collectionView;
_refreshTimer.IsEnabled = false;
_refreshTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);
Settings.Default.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case "UI_DisplayOfflineContacts":
case "UI_DisplayServices":
{
_displayOffline =
Settings.Default.UI_DisplayOfflineContacts;
_displayServices =
Settings.Default.UI_DisplayServices;
Refresh();
break;
}
}
};
searchBox.TextChanged += delegate
{
_refreshTimer.Stop();
_refreshTimer.Start();
};
collectionView.Filter = delegate(object obj)
{
IContact contact = obj as IContact;
if (contact == null)
{
return false;
}
if (!_displayServices && contact.IsService)
{
return false;
}
bool contains =
contact.SearchLowerText.Contains(searchBox.Text.ToLower());
if (contact.IsAvailable)
{
return contains;
}
else
{
return _displayOffline && contains;
}
};
_refreshTimer.Tick += _refreshTimer_Tick;
}
开发者ID:erpframework,项目名称:xeus-messenger2,代码行数:60,代码来源:FilterRoster.cs
示例9: 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
示例10: SortViewModel
public SortViewModel(ICollectionView source, SortData[] columns, IEnumerable<SortDescription> existing = null,
SortData[] requiredColumns = null) {
View = source;
Columns = columns;
_requiredColumns = requiredColumns ?? new SortData[0];
if (existing != null) {
var d = View.DeferRefresh();
SortDescriptions.Clear();
foreach (var c in _requiredColumns)
SortDescriptions.Add(c.ToSortDescription());
var item = existing
.FirstOrDefault(x => Columns.Select(y => y.Value).Contains(x.PropertyName));
if (item != default(SortDescription)) {
SelectedSort = Columns.First(x => x.Value == item.PropertyName);
SelectedSort.SortDirection = item.Direction;
SortDescriptions.Add(item);
}
d.Dispose();
} else {
var item = SortDescriptions.FirstOrDefault(x => Columns.Select(y => y.Value).Contains(x.PropertyName));
if (item != default(SortDescription)) {
SelectedSort = Columns.First(x => x.Value == item.PropertyName);
SelectedSort.SortDirection = item.Direction;
}
}
OldSelectedSort = SelectedSort;
this.WhenAnyValue(x => x.SelectedSort)
.Skip(1)
.Subscribe(x => SortColumn());
this.SetCommand(x => x.SortCommand).Subscribe(x => SortColumn());
this.SetCommand(x => x.ToggleVisibilityCommand).Subscribe(x => ToggleVisibility());
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:35,代码来源:SortViewModel.cs
示例11: 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
示例12: TextFilterService
public TextFilterService(ICollectionView collectionView, TextBox textBox)
: this()
{
string filterText = String.Empty;
_collectionView = collectionView;
collectionView.Filter = delegate(object obj)
{
if ( (obj is ServiceCategory)
|| string.IsNullOrEmpty(filterText))
{
return true;
}
Service service = obj as Service;
if (service == null || string.IsNullOrEmpty(service.Name))
{
return false;
}
return
service.Name.IndexOf(filterText, 0, StringComparison.CurrentCultureIgnoreCase) >=
0;
};
textBox.TextChanged += delegate
{
filterText = textBox.Text;
_keyTime.Start();
};
}
开发者ID:erpframework,项目名称:xeus-messenger2,代码行数:33,代码来源:TextFilterService.cs
示例13: LoadImages
internal async Task LoadImages()
{
if (_ == null || _.Length == 0)
return;
if (_initialized)
return;
_initialized = true;
IsBusying = true;
await Task.WhenAll(_.Select(DescribeImage)).ConfigureAwait(false);
IsBusying = false;
await DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() =>
{
_coll_images = new FeedImages();
}), System.Windows.Threading.DispatcherPriority.ContextIdle);
foreach (var i in _)
{
var c = i;
if (c.duration != 0)
continue;
await DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() => _coll_images.Add(new ImageUnitViewModel(c))), System.Windows.Threading.DispatcherPriority.ContextIdle);
}
await DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() =>
{
Images = CollectionViewSource.GetDefaultView(_coll_images);
}), System.Windows.Threading.DispatcherPriority.ContextIdle);
IsReady = true;
}
开发者ID:heartszhang,项目名称:famous,代码行数:30,代码来源:ImageGalleryViewModel.cs
示例14: SubPropertyEditor
// <summary>
// Basic ctor
// </summary>
public SubPropertyEditor()
{
_quickTypeCollection = new ObservableCollection<NewItemFactoryTypeModel>();
_quickTypeView = CollectionViewSource.GetDefaultView(_quickTypeCollection);
_quickTypeView.CurrentChanged += new EventHandler(OnCurrentQuickTypeChanged);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:SubPropertyEditor.cs
示例15: LibraryGroupViewModel
protected LibraryGroupViewModel(string header, string addHeader = null, string icon = null) {
Header = header;
AddHeader = addHeader;
Icon = icon;
if (!Execute.InDesignMode)
this.SetCommand(x => x.AddCommand);
Children = new ReactiveList<IHierarchicalLibraryItem>();
IsExpanded = true;
this.WhenAnyValue(x => x.SelectedItemsInternal)
.Select(x => x == null ? null : x.CreateDerivedCollection(i => (IHierarchicalLibraryItem) i))
.BindTo(this, x => x.SelectedItems);
UiHelper.TryOnUiThread(() => {
Children.EnableCollectionSynchronization(_childrenLock);
_childrenView =
Children.CreateCollectionView(
new[] {
new SortDescription("SortOrder", ListSortDirection.Ascending),
new SortDescription("Model.IsFavorite", ListSortDirection.Descending),
new SortDescription("Model.Name", ListSortDirection.Ascending)
}, null,
null, null, true);
_itemsView = _childrenView;
});
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:28,代码来源:LibraryGroupViewModel.cs
示例16: BuildMultiMaterialMeshesCollectionView
private void BuildMultiMaterialMeshesCollectionView()
{
_multiMaterialMeshesCollectionView = CollectionViewSource.GetDefaultView(MeshFile.MultiMaterialMeshFiles);
_multiMaterialMeshesCollectionView.Filter = FilterMultiMaterialMeshes;
OnPropertyChanged(() => MultiMaterialMeshesCollectionView);
}
开发者ID:Scrivener07,项目名称:moddingSuite,代码行数:7,代码来源:MeshEditorViewModel.cs
示例17: SearchClientsViewModel
public SearchClientsViewModel(List<ClientEntity> clientEntities, bool reservationMode = false)
{
_pcs = new PropertyChangeSupport(this);
_title = "Resotel - Recherche de client";
if(reservationMode)
{
_title = "Resotel - Recherche de réservation";
}
_searchClientVMs = new ObservableCollection<SearchClientViewModel>();
_searchClientVMsSource = CollectionViewProvider.Provider(_searchClientVMs);
_searchClientVMsView = _searchClientVMsSource.View;
_searchClientVMsView.Filter = _filterClientNameOrFirstName;
_searchClientVMsView.CurrentChanged += _client_selected;
HashSet<string> clientKeys = new HashSet<string>();
foreach(ClientEntity clientEntity in clientEntities)
{
if (clientKeys.Add($"{clientEntity.FirstName}{clientEntity.LastName}"))
{
SearchClientViewModel clientSearchVM = new SearchClientViewModel(clientEntity, clientEntities);
_searchClientVMs.Add(clientSearchVM);
clientSearchVM.ClientSelected += _subClient_selected;
}
}
}
开发者ID:yves982,项目名称:Resotel,代码行数:28,代码来源:SearchClientsViewModel.cs
示例18: WhatsNewViewModel
public WhatsNewViewModel()
{
_tabs = new ObservableCollection<ITab<object>>();
_tabs.Add(ServiceLocator.Current.TryResolve<WhatsNewTabItemView>());
_tabs.Add(ServiceLocator.Current.TryResolve<TopListsTabItemView>());
_tabsIcv = new ListCollectionView(_tabs);
}
开发者ID:krikelin,项目名称:torshify-client,代码行数:7,代码来源:WhatsNewViewModel.cs
示例19: MultiChoiceFeature
public MultiChoiceFeature(IProjectService projectService, IEnumerable<IFeatureItem> items)
{
this.projectService = projectService;
this.items = new ObservableCollection<IFeatureItem>(items);
this.itemsView = CollectionViewSource.GetDefaultView(this.items);
this.itemsView.SortDescriptions.Add(new SortDescription(nameof(IFeatureItem.Order), ListSortDirection.Ascending));
}
开发者ID:tforsberg,项目名称:ASP.NET-MVC-Boilerplate,代码行数:7,代码来源:MultiChoiceFeature.cs
示例20: WorldViewModel
public WorldViewModel()
{
_undoManager = new UndoManager(this);
_clipboard = new ClipboardManager(this);
World.ProgressChanged += OnProgressChanged;
Brush.BrushChanged += OnPreviewChanged;
UpdateTitle();
_spriteFilter = string.Empty;
_spritesView = CollectionViewSource.GetDefaultView(World.Sprites);
_spritesView.Filter = o =>
{
var sprite = o as Sprite;
if (sprite == null || string.IsNullOrWhiteSpace(sprite.TileName))
return false;
return sprite.TileName.IndexOf(_spriteFilter, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
sprite.Name.IndexOf(_spriteFilter, StringComparison.InvariantCultureIgnoreCase) >= 0;
};
_saveTimer.AutoReset = true;
_saveTimer.Elapsed += SaveTimerTick;
// 3 minute save timer
_saveTimer.Interval = 3 * 60 * 1000;
// Test File Association and command line
if (Application.Current.Properties["OpenFile"] != null)
{
string filename = Application.Current.Properties["OpenFile"].ToString();
LoadWorld(filename);
}
}
开发者ID:ThomasWDonnelly,项目名称:Terraria-Map-Editor,代码行数:32,代码来源:WorldViewModel.cs
注:本文中的ICollectionView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论