ModuleListPage.OnGroup(ModuleListPageGrouping) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Indicates that a group is selected.
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)
Parameters
- grouping
- ModuleListPageGrouping
The selected group.
Examples
The following example implements the OnGroup method.
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;
}
}
}
Remarks
When a user selects a specific grouping, the base class will call this method to assign each item in the System.Windows.Forms.ListView object to a System.Windows.Forms.ListViewGroup object.