am making a windows phone 8.1 application, i am using hub section template and in that i have a textbox, i want to access its value on an event. I can't find a way to do so, i am not using any binding.
Here is XAML
<HubSection x:Uid="HubSection4" Header="SEARCH PACKAGE" DataContext="{Binding Groups[2]}" HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<TextBox x:Name="searchBox" IsSpellCheckEnabled="True" KeyDown="AnyKeyDown"/>
</DataTemplate>
</HubSection>
Here is code:
private async void AnyKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
{
//call the magic function
var messageDialog = new MessageDialog(searchBox.data);
// Show the message dialog
await messageDialog.ShowAsync();
}
}