ShowDialog的异常的XAML在Windows 8的ListView只 [英] Showdialog Xaml Exception with listview on Windows 8 only
问题描述
我在写在PowerShell中利用XAML的GUI的一个小应用程序的过程。该应用程序工作正常的Windows 7,并在工作中Windows Server 2012中,但我的家用台式机,它运行在Windows 8上它抛出一个异常。调试了一下之后,我发现了一块XAML的,这使得脚本崩溃。
I'm in the process of writing a small application in Powershell making use of xaml gui. THe application works fine on Windows 7 and Windows Server 2012 at work, but on my home desktop, which runs on Windows 8 it throws an exception. After debugging a bit, I discovered the piece of xaml which makes the script crash.
[xml]$Xaml = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Windows Monitoring Framework" WindowStartupLocation="CenterScreen" Height="386" MinHeight="386" MaxHeight="400" Width="738" MinWidth="750" MaxWidth="750">
<Grid Margin="0,0,2,0">
<TabControl Name="WmfTabControl">
<TabItem Name="TabInfo" Header="Info">
<Grid Margin="0,0,-1,0">
<Label Name="lblInfoHostname" Content="Hostname" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,-1,0,0" Foreground="#FFFFFF" Background="#FF2E78E4" FontWeight="Bold" FontSize="14"/>
<Label Content="Recent Alerts" HorizontalAlignment="Left" Margin="0,26,0,0" VerticalAlignment="Top" Height="24" Width="113" Background="#FF2E78E4" Foreground="#FFFFFF" FontSize="11" FontWeight="Bold"/>
<ListView Name="lvRecentAlert" Margin="0,50,0,159">
<ListView.View>
<GridView>
<GridViewColumn Header="Date" Width="80"/>
<GridViewColumn Header="Service" Width="120"/>
<GridViewColumn Header="Alert" Width="300"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>
'@
$Reader=(New-Object System.Xml.XmlNodeReader $Xaml)
$Form=[Windows.Markup.XamlReader]::Load( $Reader )
$Form.ShowDialog() | out-null
当我离开的部分。
<GridViewColumn Header="Date" Width="80"/>
<GridViewColumn Header="Service" Width="120"/>
<GridViewColumn Header="Alert" Width="300"/>
出了XAML,它再次工作。
out the xaml, it works again.
扔在我的Windows 8的错误是:
The error thrown on my Windows 8 is:
Exception calling "ShowDialog" with "0" argument(s): "The file exists.
"
At C:\Users\Willem\Dropbox\Scripts\Powershell\Tools\Windows_Monitoring_Framework\Windows_Monitoring_Framework.ps1:465 char:1
+ $Form.ShowDialog() | out-null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IOException
我一直在找了几个小时什么问题可能是,但我有点卡住。因为我想继续在家里剧本的工作,我会非常感激,如果有人知道有什么问题可能是。
I've been looking for hours what the issue might be, but I'm kind of stuck. As I would like to continue working on the script at home, I would be very thankful if someone would know what the issue might be.
Grtz
威廉
推荐答案
好吧,我似乎设法通过运行一个广泛的CCleaner的解决这个问题。一定有我的系统上的东西难看。 CHeerz:)
Well, seem I managed to solve this by running an extensive ccleaner. THere must have been something ugly on my system. CHeerz :)
这篇关于ShowDialog的异常的XAML在Windows 8的ListView只的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!