views:

804

answers:

1

I am creating a control where I am simulating a popup by using a canvas that contains a textbox and a grid container. The size of the canvas gets set to the size of the textbox and the textbox is positioned at 0,0 within the canvas. The Grid container is positoned at the y coordinate of the textbox and its visibility is set to Collapsed. When the textbox receives focus, the Grid container's visibility is set to Visible and the z-index of the canvas is set to a higher number so that the Grid pops out above other content outside of the rect bounds of the canvas but does not disturb other content. The Canvas is a descendant of a container control that is the content of a ScrollViewer.

The issue that if the Grid container expands, it can exist out side of the bounds of the scrollviewer and the scrollviewer is not notified that it needs to provide more scrollbar. I've thought about briefly changing the size of the canvas to auto so that it will somehow notify the scrollviewer, and then returning it back to it's original size so that it will not disturb sibling content.

Alternatively, another acceptable solution would be to change the position of the Grid container if it is going to be expanded to the right or bottom bounds of the scrollviewer. If the bottom of the Grid extends past the bounds of the scrollviewere I will position it's canvas left and bottom at 0,0 as well as the additional conditions(bottom and right extending past, right extending past). The benefit of this would be that I do not need to mess with the size of the canvas in order to notify the scrollviewer, as well as the fact that I don't even want scrolling to be enabled when the popup is open. This would just change the position the grid in full view in the scrollviewer when it becomes visible. Ultimately, I think this would be a better solution, how to determine if an element has clipped the bounds of the scrollviewer.

A: 

Ok.. This is NOT a question.. so what do you expect to receive as an answer? Maybe only a "good luck guy!"

edibile