ChildWindow and adorners

Oct 7, 2011 at 6:35 PM

Using the child window for the first time.

I have controls in the main windows that show error state with adorners (setting the ErrorTemplate). When the ChildWindow is shown, the error adorners are visible through the window. I assume this is because they both reside in the same layer, but I do not know how to force the ChildWindow to be topmost.

Also, I cannot seem to show/hide the window through a visibility binding:

WindowState="{Binding Path=WindowState, Mode=TwoWay}"

Property using INotifyPropertyChanged interface:

private WindowState _WindowState = WindowState.Closed;

public WindowState WindowState
{
   get { return _WindowState; }
   set
   {
      _WindowState = value;
      this.OnPropertyChanged("WindowState");
   }
}
Any help on either issue? Thanks,

Oct 7, 2011 at 6:40 PM
Edited Oct 7, 2011 at 6:42 PM

Could you provide a sample application for the first issue?

As for your second issue; what you have looks correct.  How are you changing the value?  Are you setting the backing field _WindowStat = new value or are you setting the Property WindowState = new value?  Do you have any binding errors in your output window?

Have you looked at the ChildWindow samples in the Sample application?

Oct 10, 2011 at 11:43 AM
Edited Oct 10, 2011 at 11:48 AM

Hi, thanks for response.

For the first issue of the adorners, I ended up finding a workable solution by wrapping my control (with the controls that would have error templates) inside an AdornerDecorator. This seemed to fix the issue and hide the adorners below the ChildWindow when the window is shown.

As for the second issue, I am definitely changing the value through the property: WindowState = WindowState.Open. So I don't see why it would not be working. I do not have any binding errors in the output window--all seems to be well. The window works fine when I call Show() but I am working with MVVM and wanted to avoid code-behind so was doing it through properties. My only thought is that the Show() method must do something else that simply changing the property can't accomplish. But I've seen other threads where people said this binding worked fine so I'm not sure what I'm missing. Is there any other property I must set to make sure the window shows?

 

EDIT: Nope, apparently I was wrong. I tried again and am indeed getting a binding error for the property. I have some nested user controls, and for some reason it is referring to a child control I was not expecting. I should be able to fix that now--thanks for the help!

Oct 10, 2011 at 1:52 PM

I am glad you have solved your problem.  Thanks for using the Extended WPF Toolkit.