Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
仅在Windows 8上具有listview的Showdialog Xaml异常_Xaml_User Interface_Listview_Powershell_Exception - Fatal编程技术网

仅在Windows 8上具有listview的Showdialog Xaml异常

仅在Windows 8上具有listview的Showdialog Xaml异常,xaml,user-interface,listview,powershell,exception,Xaml,User Interface,Listview,Powershell,Exception,我正在使用xaml gui在Powershell中编写一个小应用程序。该应用程序在Windows 7和Windows Server 2012上工作正常,但在Windows 8上运行的“我的家庭桌面”上会引发异常。经过一点调试,我发现了导致脚本崩溃的xaml片段 [xml]$Xaml = @' <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc

我正在使用xaml gui在Powershell中编写一个小应用程序。该应用程序在Windows 7和Windows Server 2012上工作正常,但在Windows 8上运行的“我的家庭桌面”上会引发异常。经过一点调试,我发现了导致脚本崩溃的xaml片段

[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
我已经找了好几个小时问题可能是什么,但我有点卡住了。由于我想在家里继续写剧本,如果有人知道可能会有什么问题,我将非常感激

格尔茨


Willem

嗯,看来我通过运行一个广泛的ccleaner解决了这个问题。我的系统一定有问题。干杯:)

好的。。我创建了一个新的Windows 8配置文件,它似乎在那里工作。。所以我想这是一个“本地”问题。。现在我只需要找到原因…^^奇怪的是,一个蹩脚的gridviewcolumn标题会花费我这么多时间。除了创建一个新的个人资料,有人有什么建议吗?
                                <GridViewColumn Header="Date" Width="80"/>
                            <GridViewColumn Header="Service" Width="120"/>
                            <GridViewColumn Header="Alert" Width="300"/>
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