Well, depending on why you wrap the button with a custom control, you can define a custom control that inherits from the button. Then, instead of wrapping the button and exposing the wrapped methods and properties you want, you can simply override the methods and properties whose behavior you want to define a custom control for. This way you get all the functionality of a button without having to reinvent the wheel.
Here is the google link that will take you through it (one of the first I found is a lot of them): http://knol.google.com/k/creating-custom-controls-with-c-net#
If the user has other problems, this may not be for you, but I offer this answer because the only goal you mentioned is to wrap the button. I personally would like to create a custom control and inherit, not user control and wrapping, if the control in question is just intended for a more specific type of wrapped / inherited control (i.e., Buttons in your case).
Edit: In light of the updated question ...
You could do something in this direction. Here is the XAML client of your user control:
<Grid> <local:MyControl ButtonContent="Click Me!"/> </Grid> </Window>
Here is the XAML for the user control itself:
<UserControl x:Class="GuiScratch.MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:GuiScratch" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <StackPanel> <ContentControl Content="Asdf"/> <Button Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MyControl}},Path=ButtonContent}"/> </StackPanel> </Grid> </UserControl>
And here is the code:
public partial class MyControl : UserControl { public static readonly DependencyProperty ButtonContentProperty = DependencyProperty.Register("ButtonContent", typeof(object), typeof(MyControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender)); public object ButtonContent { get { return (object)GetValue(ButtonContentProperty); } set { SetValue(ButtonContentProperty, value); } } public MyControl() { InitializeComponent(); } }
So, you do not need to handle the binding at all through the code. Your XAML client binds to the dependency property, as does the user's XAML itself. So they share the dependency property setting. I ran this in my little notebook, and the result (at least my understanding) of what you are looking for. The main window displays the user control as a stack panel with the text "Asdf", and then a button with the text "Click Me!"