I have following user control
<UserControl x:Class="Station.Controls.FilterTraceDataControl" 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" mc:Ignorable="d"> <TextBox x:Name="PartNumbTextBox" Width="120" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="5,0,0,0" Height="25"/> </UserControl> I use it with my main window:
<Window xmlns:controls="clr-namespace:Station.Controls" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Station.MainWindow" Title="{Binding ApplicationTitle}" MinHeight="550" MinWidth="850" Height="650" Width="900" DataContext="{Binding Main, Source={StaticResource Locator}}"> <controls:FilterTraceDataControl Grid.Row="1" Visibility="{Binding FilterBarVisible ,Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"/> </Window> Window's Mainview has following property:
public string SelectedRefDesFilter { get { return _selectedRefDesFilter; } set { _selectedRefDesFilter = value; RaisePropertyChanged("SelectedRefDesFilter"); } } How I can databind "PartNumbTextBox" from UserControl to this Property.
Thanks.