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;
}
}