Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is my wpf application starting in web browser?

Tags:

c#

.net

wpf

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()));
        }
    }
}
like image 974
logeeks Avatar asked Dec 16 '22 13:12

logeeks


1 Answers

Because you create WpfBrowserApplication. Create Wpf Application and everything will be fine

enter image description here

like image 154
Stecya Avatar answered Jan 14 '23 02:01

Stecya