locked
Edit UserControl in Content of Another UserControl in Designer RRS feed

  • Question

  • Hi,

    I'm building a Wizard UserControl. It consists of the main wizard control which houses wizardpage controls. Both are defined as simple UserControls.

    I am trying to get this to work similar to the TabControl, meaning that I can set a selected WizardPage and then in the designer display and be able to edit the content of the selected page.

    I have gotten it to where I can set the currently selected page and the designer updates and displays that page. And I can edit the XAML for the content of the page.

    But, in the designer, all I can click on it the WizardControl itself. I can't click on the content of the selected WizardPage.

    The way I have it wired up is that I placed a ContentControl in the area of the WizardControl where the pages would go. I expose this control by overriding the Content property on the UserControl:

        Public Shadows Property Content As Object
            Get
                Return Me.ContentHost.Content
            End Get
            Set(ByVal value As Object)
                Me.ContentHost.Content = value
                UpdateLayout()
            End Set
        End Property

    I expose the content property the same way on the WizardPage control.

    I have a SelectedPage DP on the WizardControl that when changed sets the content of the WizardControl to the selected WizardPage. This is how the selected WizardPage is displayed within the WInzardControl.

    But what do I need to do so that the content of the selected WizardPage is editable within the designer, like with the standard TabControl, when you select a different tab, you can edit the contents of that tab. I want to be able to do the same.

    Thanks,

    Josh


     

    Thursday, April 26, 2012 3:29 PM

Answers

  • Man, I don't know what the deal is with these forums anymore. This used to be a place where one could get help from the community and find answers. That has not been my experience lately. Seems like questions aren't answered anymore. I wonder what's up with that.

    Anyway, enough whining, I thought I should post the answer that I arrived at on my own in case anyone else has this question.

    While I was not able to determine if what I was trying to do is even possible, I decided to convert my UserControls into custom controls that derived from ContentContainer.

    By doing that, the content area of both the Wizard and WizardPage controls is now editable.

    Thursday, April 26, 2012 6:34 PM