Posts

Showing posts with the label binding

WPF custom UserControl - Property Binding

Image
WPF custom UserControl - Property Binding I try to develop a UserControl look like a TextBox white two different changes. UserControl TextBox First of all the new TextBox has to display a "PlaceholderText" if the TextBox text value is empty. My solution for this implementation includes a second TextBox white the "PlaceholderText" as simply Text Attribute. At last I changed the visibility an the focus to the other TextBox . TextBox TextBox TextBox TextBox An when the Textbox ValidationResult Object return false they display a TextBlock white an "ErrorMessage" TextBlock They tow implementations are already working and existent. For my new TextBox I copied all the TextBox specific properties into my new control and passed them to the original TextBox . TextBox TextBox TextBox Now I tried to bind the Text property from my new control to a DependencyPropery Object (in the ViewModel). Text My implementation looks this: Custom TextBox Text property publi...