Why does my wpf application run in a web browser?

I created a wpf application that has one window that runs in a web browser. I need to run it as a standalone application.

The code goes below.

<Application x:Class="WPFTESTER.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Page1.xaml"> <Application.Resources> </Application.Resources> </Application> <Window x:Class="WPFTESTER.MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid> <telerik:RadGridView x:Name="testGrid" AutoGenerateColumns="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/> <telerik:GridViewDataColumn IsReadOnly="True"> <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <telerik:RadButton Click="RadButton_Click" Content="Button1"/> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn IsReadOnly="True"> <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <telerik:RadButton Click="RadButton_Click" Content="Button2"/> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid> </Window> using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Telerik.Windows.Controls.GridView; using Telerik.Windows.Controls; namespace WPFTESTER { /// <summary> /// Interaction logic for Page1.xaml /// </summary> public partial class MyWindow : Window { public MyWindow() { InitializeComponent(); } private void RadButton_Click(object sender, RoutedEventArgs e) { MessageBox.Show(String.Format("{0} was clicked", (sender as RadButton).Content.ToString())); } } } 
+4
source share
2 answers

Because you are creating WpfBrowserApplication . Create a Wpf app and everything will be fine

enter image description here

+9
source

In the application block you have

 StartupUri="Page1.xaml"> 

I assume you need to change this as the name of your xaml homepage.

Also check the type of project - should not be a "browser"

+3
source

All Articles