locked
Showing view in other view RRS feed

  • Question

  • Hi guys!

    I've got a View A that shows some items.  Now, I want to show other View B (rectangle with a  textbox inside) inside the  View A when there are no items to show.

    So  in ViewModel i'm checking how many items are displayed and when it's 0 then I show the View B.

     It's easy with a ChildWindow as I simply establish a new instance of a View and fire Show() function.

    How to solve it when it's not ChildWindow? I can create an instance of View B but what then? Kind of RootLayout.Children.Add...?

    Thanks in advance!
    cheers

    pete

     

    Friday, June 18, 2010 11:56 AM

Answers

  • Hi,

       IMO, instead of making two seperate view, how about just one view with different states.

       Say when item.count = 0 , you view go to "empty item" states with only  rectangle and one textbox in it.

       With this approach , you can easily give it some transitional effect

    Best Regards 

    Monday, June 21, 2010 10:43 PM

All replies

  • You could make it a stack panel and just add it to the children.  If you wanted to place it in a specific spot, you could add Border element to your LayoutRoot grid, size it, position it, etc.  Then add your new view as a child of the Border when needed.

    Friday, June 18, 2010 12:31 PM
  •  isn't refering from ViewModel to elements in View against MVVM pattern?

    Friday, June 18, 2010 12:36 PM
  • Hi,

       IMO, instead of making two seperate view, how about just one view with different states.

       Say when item.count = 0 , you view go to "empty item" states with only  rectangle and one textbox in it.

       With this approach , you can easily give it some transitional effect

    Best Regards 

    Monday, June 21, 2010 10:43 PM