开发者

More Issues Opening Window WPF

开发者 https://www.devze.com 2023-02-05 19:49 出处:网络
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:

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"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号