I have developed a user control in WPF where one of the controls is a text box which in my user control I declare it in the following way:
<TextBox Name="PathTextBox" Text="{Binding PathControlValue, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged }" Grid.Column="0" />
In the code behind I have declared the following:
public string PathControlValue
{
get { return (string) GetValue(PathValueProperty); }
set { SetValue(PathValueProperty, value); }
}
Along with:
public static DependencyProperty PathValueProperty = DependencyProperty.Register(
"PathControlValue",
typeof(string),
typeof(FolderChoosed),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
When I use my user control in a wpf window I do it in the following way:
<customUserControl:FolderChoosed Grid.Column="0" LabelControlValue="Banco anexo" Margin="10"
x:Name="BancoAnexo" Grid.Row="0"
ToolTipControlTitleValue="Banco anexo"
ToolTipControlDescriptionValue="Proporciona la ruta de los anexos"
PathControlValue="{Binding CompanyMapperDto.BancoAnexoPath, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"/>
When My window is initialized, I do the following:
InitializeComponent();
_parameterService = IsnContainer.Resolve<IParameterService>();
_dataBaseProviderService = IsnContainer.Resolve<IDataBaseProviderService>();
DataContext = this;
Obviously I have my Window declared in the following way:
public partial class CompanyMapper : Window, INotifyPropertyChanged
And the property that links my user control is:
private CompanyMapperDto _companyMapperDto;
public CompanyMapperDto CompanyMapperDto
{
get { return _companyMapperDto; }
set
{
_companyMapperDto = value;
OnPropertyChanged(nameof(CompanyMapperDto));
}
}
Even so, the text box of my user control does not link the information as it should be expected, because once my object is loaded, the user control in its textBox is still empty ...
Any suggestions