![]() Wrap the ModalClass into your control, the MessageBox shows how to use this technique.Use as a helper class and pass in the ShowModal function of the UserControl you want to show modally.You may employ services provided by the ModalControl class in two ways: We use the ModalControl class externally.Īnd, here is the modal dialog: Using the Code Here, we see the Silverlight Wizard shown modally without making any changes to it. I have also added a Show Dialog button that will popup a modal dialog window that I have implemented by aggregating ModalControl. Here, we can see the Silverlight Wizard project main page changed so a button shows the wizard modally. This project builds on the Silverlight Wizard project by showing how to show the Wizard modally, and I have also built a MessageBox that demonstrates how the ModalControl class can be wrapped up to create a self contained modal window. Hosted control is prevented from being dragged outside the browser's window.Centering the hosted control when the browser is resized.Modal display of any UserControl derived control.After some thinking, I realised that aggregation must be the solution. That made me think how else I could achieve the same behaviour without losing designing with Blend. But, the Expression Blend designer window does not display controls that are not derived directly from UserControl, so we lose all the nice design features of Blend. That works very well, and it is the most complete and easy to use implementation. My first implementation of this class required that you derive your controls from it in order for them to be displayed modally. This article shows how to implement a class that enables a modal display of any UserControl derived control. The demo project shows how to use the ModalControl and updated MessageBox. ModalControl.ParentHost = LayoutRoot // Init the parent controlĪfter the initialisation of the ModalControl.ParentHost, you may use modal windows to host ComboBoxes and DataGrids. Public partial class MainPage : UserControl
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |