WPF Custom TextBox How do I get Text into it?
Hi, I am learning WPF and I am trying to learn MVVM. I have a usercontrol which has a textbox and a textblock and I would like to know how to make it so when I use the usercontrol, I am able to set text in the textblock. I feel like I am close however missing something. I am not sure what to search on google to find an answer so here I am!
My current code is attached in the images!



5 Replies
if i understood your goal correctly you are searching for dependencyproperties
Dependency properties overview - WPF .NET
Learn about the WPF property system and the capabilities of a dependency property, which is a property that's backed by the WPF property system.
alternatively maybe customcontrols are more appropriate
start here reading;
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/control-authoring-overview?view=netframeworkdesktop-4.8
Control Authoring Overview - WPF .NET Framework
The extensibility of Windows Presentation Foundation controls minimizes the need to create custom controls. Learn how to create a new control, if necessary.
I appreciate it, this solved my issue