Change addin custom pane icon

70
5
Jump to solution
Thursday
sbayarri_gilytics
New Contributor II

Hi! I'm creating an ArcGIS Pro 2.9 addin with some custom panes. 

Since the number of visible panes may multiply, I was wondering how to change the default "green button" icon visible in the pane captions, so different types can be easily seen apart.

I tried finding largeImage/smallImage properties in the UserControl XAML for my panes but they don't seem to exist. I also tried setting the LargeImage and SmallImage properties in the custom ViewModel constructors:

// First option: no image is visible

LargeImage = "pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonRed32.png";

// Second option: some kind of exception, the pane doesn't appear

LargeImage = new BitmapImage(new Uri("pack://application:,,,/Module1;component/Images/GenericButtonRed32", UriKind.Absolute));

 

Any help appreciated,

   Salvador

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
GintautasKmieliauskas
Regular Contributor

Hi,

I have copied code from my addin. It works as in your attached picture. 

P.s.

You can check ArcGIS Community Sample :

https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/CustomPaneWithC...  Change daml'e  as I wrote above with your own picture

View solution in original post

5 Replies
GintautasKmieliauskas
Regular Contributor

Hi,

Pane in daml has property smallimage:

      <panes>
        <pane id="My_Pane" caption="My Pane" className="MyPaneViewModel" smallImage="Images\pane16.png" defaultTab="xxx" defaultTool="esri_mapping_navigateTool">
          <content className="MyPaneView" />
        </pane>
      </panes>

Image\pane16.png must be set to AddInContent.

Is it possible to set image on fly I don't know.

 

0 Kudos
sbayarri_gilytics
New Contributor II

Hi, Gintautas. Thanks for your answer. However, my pane (generated with the ArcGIS Pro Visual Studio helper) is defined in its own .xaml file, which has this structure:

<UserControl x:Class="myAddin.MapProjectPaneView" ...>
    <UserControl.Resources>
     ...
    </UserControl.Resources>
    <Grid>
      My controls go here
    </Grid>
</UserControl>

Not sure if this is compatible with the <Panes> content you describe for config.daml.

Thanks!

0 Kudos
GintautasKmieliauskas
Regular Contributor

Hi,

I have copied code from my addin. It works as in your attached picture. 

P.s.

You can check ArcGIS Community Sample :

https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/CustomPaneWithC...  Change daml'e  as I wrote above with your own picture

sbayarri_gilytics
New Contributor II

Thanks, Gintautas!  It is clear now. Even if the custom pane has its own .xaml, its icon can be defined by adding a Pane entry in the config.daml with the corresponding ID and class name. It works as expected.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Note: Salvador, the file Gintautas is referring to is the Config.daml and not the user control .xaml (which contains the WPF definition)