I've hit some strange functionality with a Windows 8.1 app.
I have a UserControl defined in xaml for creating a note against certain parts of a picture.
<Grid HorizontalAlignment="Left" VerticalAlignment="Top">
<CheckBox x:Name="NoteCheckBox" Style="{StaticResource ButtonCB}" HorizontalAlignment="Center" Unchecked="NoteCheckBox_Unchecked" IsTabStop="False" >
<Grid>
<SymbolIcon Symbol="Edit" Foreground="Black" />
<FlyoutPresenter x:Name="TextFlyout" Visibility="{Binding IsChecked, ElementName=NoteCheckBox, Converter={StaticResource VisibilityConverter}}" Grid.ColumnSpan="3" Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Right" MaxWidth="600" MaxHeight="600">
<Border Background="White" Opacity="0.5" BorderThickness="2" BorderBrush="Black">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="ViewNoteStack" Orientation="Horizontal">
<Button x:Name="CloseButton" x:Uid="CloseButton" Click="CloseButton_Click" />
<Button x:Name="EditButton" x:Uid="EditButton" Click="EditButton_Click" />
</StackPanel>
<StackPanel x:Name="EditNoteStack" Orientation="Horizontal" Visibility="Collapsed">
<Button x:Name="CancelButton" x:Uid="CancelButton" Click="CancelButton_Click" />
<Button x:Name="DoneButton" x:Uid="DoneButton" Click="DoneButton_Click" />
</StackPanel>
<TextBlock x:Name="nText" Grid.Row="1" MaxWidth="200" MaxHeight="200"/>
<TextBox x:Name="TextEntry" Grid.Row="1" Visibility="Collapsed" AcceptsReturn="True" Width="200" MaxHeight="200"/>
</Grid>
</Border>
</FlyoutPresenter>
</Grid>
</CheckBox>
</Grid>
I add the note to the picture like so.
private void BgBorder_Tapped(object sender, TappedRoutedEventArgs e)
{
if (addingNote)
{
Point pt = e.GetPosition(MyCanvas);
currentNote = new Note() { X = pt.X, Y = pt.Y, Text = "" };
ViewModel.Notes.Add(currentNote);
NoteFlyout currentNotF = new NoteFlyout();
currentNotF.NoteEnabled = true;
currentNotF.SetEditMode();
currentNotF.Margin = new Thickness(currentNote.X, currentNote.Y, 0, 0);
MyCanvas.Children.Add(currentNotF);
}
}
And get a nice flyout where I can enter my note.
I start entering text into the TextBox with out any issues until I press the space bar. At this point the flyout closes, as it appears the space bar is toggling the check box which closes it. Does anyone know why this would happen? Its a bit odd that it would do it when the focus is on the TextBox.
Aucun commentaire:
Enregistrer un commentaire