Select to view content in your preferred language

Styling Graphic

1017
4
10-18-2010 11:21 AM
BjørnarSundsbø
Deactivated User
Hi

I would very much like to be able to style a Graphic in XAML, but since alot of the properties are not DependencyProperties (and Graphic is not a FrameworkElement), I am unable to affect these changes, and the style is useless. I want to be able to style it and use templates/triggers to be able to change appearance of the graphic based on changes to the object being displayed as I would any other WPF control. Also support for binding attributes, such as rotation and other details.

I suppose IRenderer is the interface to use here, but a renderer able to get symbols and geometries from a Graphic would be more in the WPF style of defining appearance than the "old" renderer approach used in arcobjects.

Also binding the geometry to my viewmodel. Any immediate plans for extending the API to support this kind of functionallity?

Bjørnar Sundsbø
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
You can style graphic by either setting its Symbol or setting its layer's Renderer. You can update the symbol templates too to change the appearance according to your need.  There are several samples here: http://esriurl.com/slsdk2

Was there anything specific that you cannot do using the above approach?
0 Kudos
BjørnarSundsbø
Deactivated User
So far I haven't found anything, though I've just started looking into rotation. The reason I asked was just to style items the same way as I'm used to with other WPF components.
0 Kudos
JenniferNery
Esri Regular Contributor
Ah okay. I can bring it up for discussion with our team lead to see what he thinks. Thanks for the suggestion, we'll take that under advisement.
0 Kudos
BjørnarSundsbø
Deactivated User
That would be great. One possible downside might be "heavy" objects as they would derive from FrameworkElement instead of DependencyObject.

My initial reason for wanting this, in addition to "doing it the WPF way", was that I could have a wrapper class inheriting from Graphic, and have a dependencyproperty containing my ViewModel. I could then use style triggers to change the appearance. Of course, I would then have to create additional objects to get this working.

Any plans for better support for MVVM patterns?
0 Kudos