WPF: How do I edit the contents of a DockPanel that is located inside a UserControl?

I've created a user control (in vb.net code) that contains two dock panels, one for header content (called HeaderDockPanel) and one for other content (called RootDockPanel). The dockPanels are depedency properties of the user control.

These dependency properties are declared as follows:

Public Shared ReadOnly RootDockPanelProperty As DependencyProperty = DependencyProperty.Register( _
       "RootDockPanel", GetType(DockPanel), GetType(MyUserControl), New PropertyMetadata( _
       Nothing))

Public Shared ReadOnly HeaderDockPanelProperty As DependencyProperty = DependencyProperty.Register( _
            "HeaderDockPanel", GetType(DockPanel), GetType(MyUserControl), New PropertyMetadata( _
            Nothing))

I've tried to change the content of these dock panels as follows but I've had no sucess:

<Wpf:EditBaseControl>
    <Wpf:MyUserControl.HeaderDockPanel>
        <DockPanel>
            <Button Content="buttonContent" />
            <TextBlock Text="textBlock" />
        </DockPanel>
    </Wpf:MyUserControl.HeaderDockPanel>
</Wpf:EditBaseControl>

How do I edit the contents of a DockPanel that's inside a UserControl?

Answers


1 I am not getting your design approach correctly here. Why do you need a Dependancy property as DockPanel. You can directly refer the DockPanel in your usercontrol code behind if you set x:Name property in the XAML and access that name say _dockPanel. Access _dockPanel.Children property to manipuate its chidren,

2 Another thought on the DPs, you might need to add the DockPanel instances to Wpf:EditBaseControl as Content on DependancyPropertyChanged event.

3 If you want to try lookless way (ie, WPF Custom control), then I would suggest you to create a HeaderedItemsControl for this purpose and set ItemsPanel as DockPanel for that control.


Need Your Help

Is it safe to set MySQL isolation to “Read Uncommitted” (dirty reads) for typical Web usage? Even with replication?

mysql database postgresql transactions replication

I'm working on a website with typical CRUD web usage pattern: similar to blogs or forums where users create/update contents and other users read the content.

Input form in Java

java swing

I'm learning swing and I've created a simple form:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.