Jesse
Jesse

Reputation: 599

Silverlight ChildWindow styling

I've set some properties in my App.xaml to implicitly style all of the ChildWindows in my app, but it doesn't seem to work.

I can set an implicit global style for any other type of control and it works, but when I set styles for ChildWindows, it literally changes nothing.

Here is an example of the XAML that doesn't work:

<Style TargetType="controls:ChildWindow">
    <Setter Property="OverlayOpacity" Value="0" />
</Style>

Shouldn't this just work?

Upvotes: 2

Views: 1156

Answers (1)

AnthonyWJones
AnthonyWJones

Reputation: 189437

The problem is that impilict styles only apply to controls of the specific type referenced by the TargetType. They do not apply to derived types of the TargetType.

Since you will never be creating an instance of ChildWindow but will be creating only derived types of ChildWindow the style does not apply.

For such a small variation you might as well just include OverlayOpacity="0" in the Xaml of your child windows.

Upvotes: 2

Related Questions