I'm using VB.net and WPF 4.
I cannot seem to open a new window in WPF consistantly. It will work one time, and then the next time I execute the same script, it throws the following exception:
XAMLParseException occured 'Provide value on 'System.Windows.Baml开发者_如何转开发2006.TypeConverterMarkupExtension' threw an exception.' Line number '4' and line position '208'. {Cannot evaluate expression because the code of the current method is optimized.}
Here is the script:
Dim Window As Window = New GAME_WINDOW
Window.Show()
Yes, "GAME_WINDOW" is a legitimate WPF window. Here are the first four lines of XAML code for the window I'm trying to open:
<Window x:Class="GAME_WINDOW"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Operation SpyRat: Word4Word" Icon="/VBP-WORD4WORD;component/alicia.ico" WindowState="Maximized" Background="Black" xmlns:my="clr-namespace:VBP_WORD4WORD">
I suspect the problem is the window Icon specification in the XAML. Try removing the Icon="..." from your XAML, and see if it corrects the issue.
If so, you'll need to make sure this is specified in proper Pack URI format. Most likely, this would be:
Icon="pack://application:,,,/component/alicia.ico"
精彩评论