ModuleListPage.Filter Property
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.
Gets the filter for the page.
protected:
virtual property Microsoft::Web::Management::Client::ModuleListPageFilter ^ Filter { Microsoft::Web::Management::Client::ModuleListPageFilter ^ get(); };
protected virtual Microsoft.Web.Management.Client.ModuleListPageFilter Filter { get; }
member this.Filter : Microsoft.Web.Management.Client.ModuleListPageFilter
Protected Overridable ReadOnly Property Filter As ModuleListPageFilter
Property Value
The ModuleListPageFilter object. The default is null
.
Examples
The following example specifies search criteria for the filter; items that do not contain the search criteria are not added to the list view.
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 Initialize(object navigationData) {
base.Initialize(navigationData);
PreferencesStore store = GetPrefStore();
LoadPreferences(store);
string curSelectedFilter = string.Empty;
if (navigationData != null) {
if (navigationData is PropertyBag) {
PropertyBag tempBag = (PropertyBag)navigationData;
if ((string)tempBag[0] == "navigate") {
curSelectedFilter = (string)tempBag[2];
}
}
}
if (String.IsNullOrEmpty(curSelectedFilter))
curSelectedFilter = DefaultFilter();
_filter = new MyModuleListPageFilter(
"The results have been filtered by" +
curSelectedFilter, true);
_filter.FilterStr = curSelectedFilter;
}
private void LoadPages() {
ListView.BeginUpdate();
try {
ImageList.ImageCollection largeImages
= LargeImageList.Images;
ImageList.ImageCollection smallImages
= SmallImageList.Images;
smallImages.Clear();
largeImages.Clear();
smallImages.Add("mySmallImg",
myGetImage(16));
largeImages.Add("myLargeImg",
myGetImage(32));
// Populate the list of features
IControlPanel controlPanel =
(IControlPanel)GetService(typeof(IControlPanel));
Debug.Assert(controlPanel != null,
"Couldn't get IControlPanel!");
Type moduleChildPageType =
typeof(IModuleChildPage);
ModulePageInfo controlPanelPage =
controlPanel.ControlPanelPage;
View view = ListView.View;
List<ListViewItem> itemsList =
new List<ListViewItem>();
foreach (ModulePageInfo pageInfo
in controlPanel.Pages) {
Type pageType = pageInfo.PageType;
// Don't add child, home
// or disabled pages
if (!moduleChildPageType.IsAssignableFrom(pageType) &&
(pageInfo != controlPanelPage) &&
pageInfo.IsEnabled) {
PageListViewItem newItem =
new PageListViewItem(pageInfo);
// Filter out pages that don't match
// current filter
if (!String.IsNullOrEmpty(
_filter.FilterStr) &&
newItem.Text.ToUpper().Contains(
_filter.FilterStr.ToUpper())
)
continue;
Image smallImage = (Image)pageInfo.SmallImage;
Image largeImage = (Image)pageInfo.LargeImage;
if (smallImage == null)
smallImage = myGetImage(16);
if (largeImage == null)
largeImage = myGetImage(32);
newItem.ImageKey = newItem.Text;
newItem.UpdateDescription(view);
itemsList.Add(newItem);
}
}
ListView.ListViewItemCollection items =
ListView.Items;
items.Clear();
items.AddRange(itemsList.ToArray());
if (SelectedGrouping != null)
OnGroup(SelectedGrouping);
if (view == View.SmallIcon)
((ListPageListView)ListView).View = view;
} finally {
ListView.EndUpdate();
Update();
}
}
Remarks
The default implementation returns null
. This property contains the Remove filter state and description that appear when a list is filtered.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for