<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to use CommandParameter in RelayCommand? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046302#M6431</link>
    <description>&lt;P&gt;In my UI I have multiple buttons to call the OpenItemDialog and I would like to reuse the method to call the dialoge by using the CommandParameter to differentiate the initiating button.&lt;BR /&gt;How can I do this using the RelayCommand?&lt;/P&gt;</description>
    <pubDate>Tue, 13 Apr 2021 11:03:33 GMT</pubDate>
    <dc:creator>TomGeo</dc:creator>
    <dc:date>2021-04-13T11:03:33Z</dc:date>
    <item>
      <title>How to use CommandParameter in RelayCommand?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046302#M6431</link>
      <description>&lt;P&gt;In my UI I have multiple buttons to call the OpenItemDialog and I would like to reuse the method to call the dialoge by using the CommandParameter to differentiate the initiating button.&lt;BR /&gt;How can I do this using the RelayCommand?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 11:03:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046302#M6431</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2021-04-13T11:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use CommandParameter in RelayCommand?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046391#M6433</link>
      <description>&lt;P&gt;This community sample shows how to do this:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/TableControlsDockpane" target="_blank"&gt;arcgis-pro-sdk-community-samples/Map-Exploration/TableControlsDockpane at master · Esri/arcgis-pro-sdk-community-samples (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the xaml you can specify the CommandParameter:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Button Command="{Binding DataContext.TableCloseCommand, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}"
        CommandParameter="{Binding TableName}" &amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;TableName in this example is of the type string.&lt;/P&gt;&lt;P&gt;In the code behind you can use the CommandParameter by simple adding 'param' to your RelayCommand as shown here:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public ICommand TableCloseCommand { get; set; }

public AttributeTableViewModel()
{
  TableCloseCommand = new RelayCommand((param) =&amp;gt; OnCloseTab(param), () =&amp;gt; true);
}

private void OnCloseTab(object param)
{
  // cast the [object] param to the correct type [string]
  string tableName = param.ToString();
  // use your TableName CommandParameter for processing
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Apr 2021 15:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046391#M6433</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-04-13T15:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use CommandParameter in RelayCommand?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046750#M6438</link>
      <description>&lt;P&gt;Thanks Wolf, that was precisely what I needed.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 06:42:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-commandparameter-in-relaycommand/m-p/1046750#M6438</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2021-04-14T06:42:16Z</dc:date>
    </item>
  </channel>
</rss>

