1.代碼如下:
public class S35430 : ViewController<ListView>
{
protected override void OnActivated()
{
base.OnActivated();
CustomizeCollectionSource(View.CollectionSource);
View.CollectionSource.CollectionChanged += new EventHandler(CollectionSource_CollectionChanged);
}
protected override void OnDeactivated()
{
View.CollectionSource.CollectionChanged -= new EventHandler(CollectionSource_CollectionChanged);
base.OnDeactivated();
}
private void CollectionSource_CollectionChanged(object sender, EventArgs e)
{
CustomizeCollectionSource((CollectionSourceBase)sender);
}
private static void CustomizeCollectionSource(CollectionSourceBase cs)
{
if (cs != null)
cs.TopReturnedObjects = 5;
}
}
{
protected override void OnActivated()
{
base.OnActivated();
CustomizeCollectionSource(View.CollectionSource);
View.CollectionSource.CollectionChanged += new EventHandler(CollectionSource_CollectionChanged);
}
protected override void OnDeactivated()
{
View.CollectionSource.CollectionChanged -= new EventHandler(CollectionSource_CollectionChanged);
base.OnDeactivated();
}
private void CollectionSource_CollectionChanged(object sender, EventArgs e)
{
CustomizeCollectionSource((CollectionSourceBase)sender);
}
private static void CustomizeCollectionSource(CollectionSourceBase cs)
{
if (cs != null)
cs.TopReturnedObjects = 5;
}
}
欢迎转载,转载请注明出处:http://www.cnblogs.com/Tonyyang/