Pergunta

I am building a WPF application in C#.NET and I would like to grey out the window and display a StackPanel in the centre, if a condition is true, like the glass pane in Java. I will be selling my application so I would prefer not that have to ship another licence with it, and it really needs to be free.

Is there any code to let me do this?

Foi útil?

Solução

Just apply a MonochromeEffect from the WPF Shader Effect Library whenever you popup a dialog:

When opening a dialog:

Application.Current.MainWindow.Effect = new MonochromeEffect() { FilterColor = Color.FromArgb(255, 90, 90, 90) };

When closing a dialog:

Application.Current.MainWindow.Effect = null;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top