why is my wpf application starting in web browser?
I created a wpf application which have a single window which is getting started on a web browser. I need to run it as a standalone application.
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()));
}开发者_StackOverflow社区
}
}
Because you create WpfBrowserApplication. Create Wpf Application and everything will be fine
In the Application block you've got
StartupUri="Page1.xaml">
I'm guessing you need to change that to be the name of you main xaml page.
Also check the project type - should not be a 'browser app'
精彩评论