Is this a bug in visual studio 2022 or am I missing something?
I don’t know why only using a button opens the window on top like I want it to. Putting a button in the navigationview doesn’t look right.
Here is the code.
THIS CODE OPENS THE NEW WINDOW ON TOP OF ALL OTHER WINDOWS
<Button x:Name="Tvdb" Foreground="YellowGreen" FontSize="20" Background="Transparent" Click="Tvdb_Click">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="" HorizontalAlignment="Left"/>
<TextBlock Text="TheTvdb" Margin="10,0,0,0"/>
</StackPanel>
</Button>
private void Tvdb_Click(object sender, RoutedEventArgs e)
{
try
{
string target = "https://thetvdb.com";
Web webPage = new(new Uri(target));
webPage.Title = "The Tvdb";
webPage.Activate();
}
catch (Exception ex)
{
Messages.Severity = InfoBarSeverity.Error;
Messages.Title = "No Item Selected";
Messages.Message = ex.Message;
Messages.IsOpen = true;
}
}
THIS CODE OPENS THE NEW WINDOW BUT BEHIND ALL OTHER WINDOWS
<NavigationViewItem x:Name="Tvdb" Content="Tvdb" Icon="Globe" Foreground="YellowGreen" FontSize="20" PointerPressed="Tvdb_PointerPressed"/>
private void Tvdb_PointerPressed(object sender, PointerRoutedEventArgs e)
{
try
{
string target = "https://thetvdb.com";
webPage = new(new Uri(target));
webPage.Title = "The Tvdb";
webPage.Activate();
}
catch (Exception ex)
{
Messages.Severity = InfoBarSeverity.Error;
Messages.Title = "No Item Selected";
Messages.Message = ex.Message;
Messages.IsOpen = true;
}
}
New contributor
WilliamK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.