Style and Brushes programatically

828
3
09-10-2020 05:15 AM
PierreMasson
Occasional Contributor

How can I access Esri styles and brushes programatically. I searched everywhere to find something like SystemColors.ActiveBorderBrush. I want to create controls dynamically by code but can't find a way to add the style.

Tags (4)
0 Kudos
3 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

There is a ProGuide for styling:  ProGuide Style Guide · Esri/arcgis-pro-sdk Wiki · GitHub  and there are references for brushes and colors:

And here is some sample code that might be of help:  arcgis-pro-sdk-community-samples/Framework/Styling-with-ArcGIS-Pro at master · Esri/arcgis-pro-sdk-c... 

0 Kudos
PierreMasson
Occasional Contributor

I have read and review all of this but still the only way to use Esri styles and brushes is through DynamicResources. I can't find nothing in SDK where I would be able to do this but with Esri Brushes

TextBlock descrip = new TextBlock()
{
Visibility = Windows.Visibility.Visible,
TextWrapping = TextWrapping.Wrap,
TextTrimming = TextTrimming.CharacterEllipsis,
Background = Media.Brushes.Black
};

0 Kudos
UmaHarano
Esri Regular Contributor

Hi

You can try something like this code snippet below.  All the Esri brushes are listed in the wiki page shared by Wolf above.

      var esriBrush = Application.Current.Resources["Esri_BorderPressedBrush"] as Brush;
      textBlock.Foreground = esriBrush;

Thanks

Uma

0 Kudos