Muds
Muds

Reputation: 4116

How do I add a color film to entire application

this might be a very typical requirement, but has anyone ever tried to have a coloured film/cover on application. So I want when user performs an action the entire application get a red film on it. its not simply changing colour of controls, its like placing a coloured film so that everything that was white appears red, green appears yellow black remains black and so on..

I know I haven't added any attempts to this question because everything that I tried made no sense at all, only thing I can think of is to adjust RGB of every colour so that a particular value is added to it.

but here I just want to ask is there a simpler way of placing a red translucent pane on my application ?

Thanks

Upvotes: 3

Views: 66

Answers (1)

densegoo
densegoo

Reputation: 104

Like @HighCore suggested, you can simply put a control on top of everything else by putting it at the bottom of your XAML:

<Window>
    <Grid>
        <!-- Your Content Here -->
        <Grid Background="Red" Opacity="0.3" />
    </Grid>
</Window>

On that last grid you can also bind some things to it as your application needs, such as

<Window>
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVis" />
    </Window.Resources>
    <Grid>
        <!-- Your Content Here -->
        <Grid Background="{Binding MyColorCover}" Visbility="{Binding CoverIsVisible, Converter={StaticResource BoolToVis}}" Opacity="{Binding CoverOpacity}" />
    </Grid>
</Window>

This would allow you to change the film cover's color/opacity/visibility at runtime. This assumes you got your bindings/MVVM stuff set up appropriately, which is another topic altogether.

Upvotes: 1

Related Questions