ModuleListPage.OnGroup(ModuleListPageGrouping) Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Indica que se selecciona un grupo.
protected:
virtual void OnGroup(Microsoft::Web::Management::Client::ModuleListPageGrouping ^ grouping);
protected virtual void OnGroup (Microsoft.Web.Management.Client.ModuleListPageGrouping grouping);
abstract member OnGroup : Microsoft.Web.Management.Client.ModuleListPageGrouping -> unit
override this.OnGroup : Microsoft.Web.Management.Client.ModuleListPageGrouping -> unit
Protected Overridable Sub OnGroup (grouping As ModuleListPageGrouping)
Parámetros
- grouping
- ModuleListPageGrouping
El grupo seleccionado.
Ejemplos
El ejemplo siguiente implementa el método OnGroup.
class DemoPage : ModuleListPage {
public DemoPage() : base() { }
ModuleListPageGrouping _entryTypeGrouping;
private ModuleListPageSearchField[] _searchFields;
// contains filter string and a ModuleListPageFilter
private MyModuleListPageFilter _filter;
ModuleListPageFilter _selectedFilter;
string sDate = "8-2-07";
protected override void OnGroup(
ModuleListPageGrouping grouping) {
if (grouping == _entryTypeGrouping) {
foreach (MyEntryItem item in ListView.Items) {
if (item.Entry.UserCount == 0) {
item.Group = _inheritedGroup;
} else {
item.Group = _localGroup;
}
}
} else {
Debug.Fail("Unknown grouping");
}
}
internal sealed class MyEntryInfo {
private PropertyBag _bag;
enum ext { eName, eUserCount };
public MyEntryInfo(PropertyBag bag) {
_bag = bag;
}
public string Name {
get {
return (string)_bag[(int)ext.eName];
}
set {
_bag[(int)ext.eName] = value;
}
}
public int UserCount {
get {
object o = _bag[(int)ext.eUserCount];
if (o == null) {
return 0;
}
return (int)o;
}
set {
_bag[(int)ext.eUserCount] = value;
}
}
}
internal class MyEntryItem : ListViewItem {
private MyEntryInfo _entry;
public MyEntryItem(MyEntryInfo entry)
: base(entry.Name, 0) {
_entry = entry;
this.SubItems.Add(new ListViewSubItem(
this, "Local Count"));
}
public MyEntryInfo Entry {
get {
return _entry;
}
}
}
Comentarios
Cuando un usuario selecciona una agrupación específica, la clase base llamará a este método para asignar cada elemento del System.Windows.Forms.ListView objeto a un System.Windows.Forms.ListViewGroup objeto .