0

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?

Andy
  • 3,600
  • 12
  • 53
  • 84
  • I really don't understand why this question has been put on hold, especially when the question has been solved and is finished with now. I don't understand how I could have demonstrated any further understanding of the solution, etc. How should I reword the question? – Andy Jul 24 '13 at 11:53

1 Answers1

1

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;
Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154
  • Thank you for your answer, but I do believe that the Ms-PL license (the license for the library) requires you to package the licence with commercial software so I was a looking for a solution which doesn't have this requirement. Please correct me if I am wrong :) – Andy Jul 23 '13 at 16:13
  • @Andy no I don't think so. I'm using that and never had any problems. Otherwise instead of the `MonochromeEffect`, just change that to a `BlurEffect` (built-into WPF). – Federico Berasategui Jul 23 '13 at 16:17
  • Hmmm... If that isn't the case then I could just as easily use this library as it offers exactly what I want: http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator but I want to make absolutely sure that this is the case before I go ahead and include it! But if I can't use that library due to licensing restrictions, `BlurEffect` is perfect. Thank you – Andy Jul 23 '13 at 16:30
  • @Andy don't forget to mark my answer as accepted if it was useful to you =) – Federico Berasategui Jul 23 '13 at 16:42
  • Marked as accepted! :) Thanks for the link to your question. So when you say a "commercial product" I guess you're selling the software that uses the library? – Andy Jul 23 '13 at 17:48
  • @Andy right. I create business applications with a twist =) – Federico Berasategui Jul 23 '13 at 18:05
  • Sounds 'interesting'. Thanks for the help :) – Andy Jul 23 '13 at 18:21