本文整理汇总了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));
}
示例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();
};
}
示例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();
};
}
示例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();
};
}
示例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];
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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();
};
}
}
示例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();
};
}
示例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();
}
}
示例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();
}
示例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();
}
示例15: add_libraryList
private void add_libraryList(MediaContent content)
{
librarylist.Add(content);
_LibraryList = CollectionViewSource.GetDefaultView(librarylist);
_LibraryList.Refresh();
}