Is it possible to override PropertyStatus style in my apps generic.xaml?

Is it possible to override PropertyStatus style in my apps generic.xaml?

Old forum URL: forums.lhotka.net/forums/t/6635.aspx


Charleh posted on Thursday, March 19, 2009

I'd like to add some style/border stuff to the style - is there a way to customise the template by overriding the one that's contained in the CSLA build project?

RockfordLhotka replied on Thursday, March 19, 2009

Yes, absolutely. You don't do this in generic.xaml though - you do it in your app.xaml or other resource style sheet.

I'm pretty sure there's a sample showing how to do this in the Samples download.

The xaml isn't for the faint of heart, but then what xaml is? :)

Charleh replied on Thursday, March 19, 2009

I'm struggling to implement this, and I can't seem to find a good example of this in the samples.

I was trying to use a default style but it doesn't appear to want to parse my style resource files (gives me a XAML parse exception). I've got a WPF example of a numericupdown box working using a default style, but I can't get it working in Silverlight even after copying the style. I did read somewhere that you couldn't use default styles to style an element in Silverlight beta 2, has this feature been added to the release?

I want to be able to style all UI elements of a certain type such as the PropertyStatus and BusyAnimation controls, I just can't quite work out how to do it.

I've tried styles in app.xaml, generic.xaml, different syntax for the TargetType property for my style

e.g.

TargetType="csla:BusyAnimation"

or

TargetType="{x:Type csla:BusyAnimation}"

(second one throws the parse exceptions)

RockfordLhotka replied on Thursday, March 19, 2009

You are right - the sample I was thinking about is for WPF, not SL.

So I'm not entirely sure that you can replace the appearance in SL, because you can't change styles after they've been set - at least in SL 2. Hopefully SL 3 will make this easier/possible.

Copyright (c) Marimer LLC