ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / BrowseProjectFilter Class / AddFilter Method
Example

In This Topic
    AddFilter Method
    In This Topic
    Adds an instance of a BrowseProjectFilter to the Filters collection property. used to make composite filters
    Syntax
    Public Sub AddFilter( _
       ByVal filter As BrowseProjectFilter _
    ) 
    public void AddFilter( 
       BrowseProjectFilter filter
    )

    Parameters

    filter
    Example
    Workflow to open an ArcGIS Pro project using the OpenItemDialog
    {
      BrowseProjectFilter portalAndLocalProjectsFilter = new();
      //A filter to pick projects from the portal
      //This filter will allow selection of ppkx and portal project items on the portal
      portalAndLocalProjectsFilter.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_projects_online_proprojects"));
      //A filter to pick projects from the local machine
      portalAndLocalProjectsFilter.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_projects"));
      //Create the OpenItemDialog and set the filter to the one we just created
      var openDlg = new OpenItemDialog()
      {
        Title = "Select a Project",
        MultiSelect = false,
        BrowseFilter = portalAndLocalProjectsFilter
      };
      //Show the dialog
      var result = openDlg.ShowDialog();
      //Check if the user clicked OK and selected an item
      bool? ok = openDlg.ShowDialog();
      if (!ok.HasValue || openDlg.Items.Count == 0)
        return; //nothing selected
      var selectedItem = openDlg.Items.FirstOrDefault();
      //Open the project use the OpenAsync method.
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also