C
C#2w ago
jjsutton

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!
No description
No description
No description
5 Replies
ACiDCA7
ACiDCA72w ago
if i understood your goal correctly you are searching for dependencyproperties
ACiDCA7
ACiDCA72w ago
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.
ACiDCA7
ACiDCA72w ago
alternatively maybe customcontrols are more appropriate
ACiDCA7
ACiDCA72w ago
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.
jjsutton
jjsuttonOP2w ago
I appreciate it, this solved my issue

Did you find this page helpful?