I have a UserControl file that has a textbox that I want to bind to a property in the code behind file, but for some reason I can't get it to bind. Can some one please tell me what I am doing wrong. Thanks in advance.
XAML:
<ContentDialog Width="200" Height="400" Background="White" Padding="-40,-20" x:Name="addGreetingDialog" PrimaryButtonText="Save" SecondaryButtonText="Cancel" PrimaryButtonClick="addGreetingDialog_PrimaryButtonClick">
<Grid Margin="-25,0,-25,0">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF686868" Offset="0"/>
<GradientStop Color="#FF515151" Offset="1"/>
<GradientStop Color="#FF676767" Offset="0.5"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock HorizontalAlignment="Center" FontSize="24" Foreground="White" FontFamily="ms-appx:/Assets/Fonts/Roboto-Light.ttf#Roboto"
Margin="10">Add Greetings</TextBlock>
</Border>
<TextBox Grid.Row="2" PlaceholderText="Greeting" Text="{Binding NewGreeting, Mode=TwoWay}"></TextBox>
</Grid>
</ContentDialog>
Code Behind:
private string _newGreeting;
public string NewGreeting { get { return _newGreeting; } set { _newGreeting = value; } }
public AddGreeting()
{
this.InitializeComponent();
}
private async void addGreetingDialog_PrimaryButtonClick(global::Windows.UI.Xaml.Controls.ContentDialog sender, global::Windows.UI.Xaml.Controls.ContentDialogButtonClickEventArgs args)
{
}