本文整理汇总了C#中System.Windows.Data.CollectionViewSource.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# CollectionViewSource.Refresh方法的具体用法?C# CollectionViewSource.Refresh怎么用?C# CollectionViewSource.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.CollectionViewSource
的用法示例。
在下文中一共展示了CollectionViewSource.Refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainAndFilterPage
public MainAndFilterPage()
{
InitializeComponent();
var allStationsView = new CollectionViewSource { Source = Stations.GetAll() }.View;
allStationsView.Filter = x => Filter(filter.Text, fromStation, excludeStation, (Station)x);
allStations.ItemsSource = allStationsView;
Observable.FromEvent<TextChangedEventArgs>(filter, "TextChanged")
.Throttle(TimeSpan.FromMilliseconds(300))
.Subscribe(_ => Dispatcher.BeginInvoke(() => allStationsView.Refresh()));
Observable.FromEvent<KeyEventArgs>(filter, "KeyDown")
.Where(x => x.EventArgs.Key == Key.Enter)
.Subscribe(_ => Dispatcher.BeginInvoke(() =>
{
var stations = allStationsView.Cast<Station>().ToArray();
if (stations.Length == 1)
{
GoToStation(stations[0]);
}
}));
CommonApplicationBarItems.Init(this);
}
示例2: RefreshEmitsCurrentChangingEvents
public void RefreshEmitsCurrentChangingEvents()
{
var events = new List<CurrentChangingEventArgs>();
var data = new List<object> {
"First",
"Second",
"Third",
"Fourth",
"Fifth",
};
var view = new CollectionViewSource() { Source = data }.View;
view.CurrentChanging += (o, e) => events.Add(e);
view.Refresh();
Assert.AreEqual(1, events.Count, "#1");
view.Refresh();
Assert.AreEqual(2, events.Count, "#2");
}