KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Say I have a very simple UserControl that - for all intents and purposes - is nothing more than TextBox: public partial class FooBox : UserControl { public static readonly DependencyProperty FooTextProperty = DependencyProperty.Register("FooText", typeof(string), typeof(FooBox)); public FooBox() { InitializeComponent(); } public string FooText { get { return textBlock.Text; } set { textBlock.Text = value; } } } <UserControl x:Class="Namespace.FooBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid> <TextBlock x:Name="textBlock" /> </Grid> </UserControl> On the form it's declared as: <local:FooBox FooText="{Binding Name}" /> The form's DataContext is set to an object that has a Name property. But this is not working for me. What am I missing?
Tags (comma-separated)
Save Edits
Cancel