You should use this for label binding:
Content={Binding RelativeSource= {RelativeSource FindAncestor, AncestorType={x:Type wpfApplication1:UserControl1}}, Path=VersionNumber}
UserControl1 is the name of your user control class. You have to specify the namespace and the user control.
You can keep your private get it still works with this binding.
EDIT Following your code I made this demo:
//window.xaml
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpfApplication1="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525">
<Grid>
<wpfApplication1:UserControl1 VersionNumber="10"/>
</Grid>
//UserControl1
<UserControl x:Class="WpfApplication1.UserControl1"
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:wpfApplication1="clr-namespace:WpfApplication1"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" DataContext="{RelativeSource Self}">
<UserControl.Background>
<ImageBrush ImageSource="{Binding BackgroundImage}" Stretch="UniformToFill" AlignmentX="Center" AlignmentY="Bottom"/>
</UserControl.Background>
<Grid Name="mainGrid">
<Label Canvas.ZIndex="-1" Foreground="Gray" Content="{Binding RelativeSource= {RelativeSource FindAncestor, AncestorType={x:Type wpfApplication1:UserControl1}}, Path=VersionNumber}"
Height="28" HorizontalAlignment="Left" Name="versionLabel" VerticalAlignment="Bottom" />
</Grid>
UserControl1.cs
public partial class UserControl1 : UserControl, INotifyPropertyChanged
{
private string _versionNumber;
private ImageSource _backgroundImage;
public UserControl1()
{
InitializeComponent();
}
public string VersionNumber
{
private get { return _versionNumber; }
set
{
_versionNumber = value;
OnPropertyChanged("VersionNumber");
}
}
public ImageSource BackgroundImage
{
get { return _backgroundImage; }
set
{
_backgroundImage = value;
OnPropertyChanged("BackgroundImage");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
As @anees suggested you can also use dependency properties for VersionNumber and BackgroundImage:
public static readonly DependencyProperty VersionNumberProperty = DependencyProperty.Register(
"VersionNumber", typeof (string), typeof (UserControl1), new PropertyMetadata(default(string)));
public string VersionNumber
{
get { return (string) GetValue(VersionNumberProperty); }
set { SetValue(VersionNumberProperty, value); }
}
public static readonly DependencyProperty BackgroundImageProperty = DependencyProperty.Register(
"BackgroundImage", typeof (ImageSource), typeof (UserControl1), new PropertyMetadata(default(ImageSource)));
public ImageSource BackgroundImage
{
get { return (ImageSource) GetValue(BackgroundImageProperty); }
set { SetValue(BackgroundImageProperty, value); }
}