Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
Expander inside of TileHeaderPresenter
posted

Hi,

Would anyone be able to advise me on how to get the following functionality?

I have a custom TileHeaderPresenter that I would like to hold an Expander type UserControl.  This would be a place where I can put a listbox with a few buttons to perform various functions related to the content of the Tile. 

I have been able to successfully add my UserControl to the TileHeaderPresenter.  More or less, the UserControl I have added is a Grid with a Canvas (with Panel.ZIndex="99") that has an Expander control in it.  The purpose of the Canvas is my attempt to make the contents of the expander pop up and cover the UI pieces below it rather than the whole TileHeaderPresenter expanding to fit the contents of the expanded control.  This way the user can make a selection from the items in the listbox then the expander will close after the selection. The problem I am seeing with this is that the expanded content does not appear over top of the tile content.  It appears behind the content of my Tile. 

Any ideas on how to make this happen?  I have tried many different things, but I am stumped and although I feel like it has something to do with the TileHeaderPresenter's relationship to the Tile content and when each piece is created, it seems like there is a way to do it b/c I can get so close.

I have attached a sample of what I am trying to do using some templating samples from a previous thread.  You will see my addition of the 'ToolBox' at the top when you run the sample.  I took out the Header for the Tile for clarity.  The changes are in the TilesGeneric.xaml file in the TileHeaderPresenter section.

Thanks in advance,

//Amanda

TestingWPF_StyleXamTilesControl.zip
  • 385
    Verified Answer
    Offline posted

    Update/answer for this post:

    I ended up submitting this as a support request and got an answer, so perhaps it can help someone else in the future to share what info I got from support.

    Upon looking at the template for the TileHeaderPresenter, Petar in support, pointed out that the control hosting my expander was a DockPanel, which is behaving exactly as it should by expanding the dock area containing my Expander when I open the Expander.

    He presented the solution of using an Menu (duuuh!) instead of the Expander inside of a Canvas to get the behavior that I wanted.  I suppose you could use a different control besides the DockPanel as well (?), but the Menu will work for me so I didn't really investigate that much further.  The solution I am going with is to use the Menu and I plan to restyle it to make it look as much like my original expander control that I was previously trying to use.