2016-05-10 6 views
-1

私はVS2013ExpressForWDにWPFアプリケーションを持っており、この特定のアプリケーションをデバッグしようとすると例外がスローされます。 これは私のMainWindow.xamlです:WPFアプリケーションがデバッグしない

<Window x:Class="GlobalTimeElite.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="GlobalTimeElite" 
     MinHeight="500" MinWidth="700"> 
    <Grid> 
    <!-- Heading --> 
    <Button x:Name="HelpPage" Content="Help" 
      HorizontalAlignment="Top" VerticalAlignment="Left" 
      Margin="0,0,0,0" Width="20" Height="25" 
      FontFamily="Segoe UI Light" FontSize="14" 
      Click="SwitchToHelpPage"> 
    </Button> 
    <Label x:Name="Heading" Content="GlobalTimeElite" 
      HorizontalAlignment="Center" VerticalAlignment="Top" 
      Margin="0,60,0,0" 
      FontFamily="Segoe UI Light" FontSize="48"> 
    </Label> 
    <Label x:Name="SubHeading" Content="WPF Edition" 
      HorizontalAlignment="Center" VerticalAlignment="Top" 
      Margin="0,100,0,0" 
      FontFamily="Segoe UI Light" FontSize="14"> 
    </Label> 

    <!-- Desc --> 
    <Label x:Name="Description" Content="CodeBehind shalt tell thee, XAML!" 
      HorizontalAlignment="Left" VerticalAlignment="Top" 
      Margin="20,160,0,0" 
      FontFamily="Segoe UI Light" FontSize="19.5"> 
    </Label> 
    </Grid> 
</Window> 

そして、これはMainWindow.xaml.csです:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
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; 

namespace GlobalTimeElite 
{ 
    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainWindow : Window 
    { 
     public MainWindow() 
     { 
      InitializeComponent(); 

      Description.Content = "Choose one of the options you see below this text.\n" 
           + "For help about these, double click this text or clic" 
           + "k the \"HELP\" \nbutton on the upper-left corner of " 
           + "this Window."; 

     } 

     internal void SwitchToHelpPage(Object Sender, EventArgs Event) 
     { 

     } 
    } 
} 

そして、私がデバッグするとき、これはエラーメッセージです:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll 

Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '8' and line position '35'. 

If there is a handler for this exception, the program may be safely continued 

答えて

1

ファーストグリッドのボタン(x:Name="HelpPage")は無効なHorizontalAlignmentVerticalAlignmentがあります。多分あなたはそれらを交換しましたか?

Horizo​​ntalAlignmentの有効な値は、Center,Left,RightおよびStretchです。

VerticalAlignmentの有効な値は、Center,Bottom,TopおよびStretchです。

1

あなたはXamlParseExceptionを探索する必要があります。ただ、InnerExceptionを見て:あなたが列挙値を混同しまし

<Button x:Name="HelpPage" Content="Help" 
    HorizontalAlignment="Top" VerticalAlignment="Left" 

enter image description here

は、ここで問題のあるラインです。正しい方法:

<Button x:Name="HelpPage" Content="Help" 
    HorizontalAlignment="Left" VerticalAlignment="Top" 
+0

ありがとうございます...それは今働きます。 –

関連する問題