gpt4 book ai didi

c# - 窗口启动时出现 xamlParseException

转载 作者:行者123 更新时间:2023-11-30 13:15:31 26 4
gpt4 key购买 nike

<分区>

当我从应用程序中的另一个窗口显示此窗口时出现以下错误:

XamlParseException occurred 'Set connectionId threw an exception.' Line number '4' and line position '25'.

有一个内部异常(exception):

{"Unable to cast object of type 'System.Windows.Controls.TabControl' to type 'WpfApplication1.Window1'."}

我的xaml代码如下:

 <Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="482" Width="603" Loaded="Window_Loaded">
<Grid>
<TabControl Height="402" HorizontalAlignment="Right" Margin="0,0,12,0" Name="tabControl1" VerticalAlignment="Top" Width="569" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
<TabItem Header="tabItem1" Name="tabItem1">
<Grid></Grid>
</TabItem>
<TabItem Header="tabItem2" Name="tabItem2">
<Grid Height="374" Width="563">
<ListView Height="317" HorizontalAlignment="Left" Margin="6,10,0,0" Name="listView1" VerticalAlignment="Top" Width="550">
<ListView.View>
<GridView>
<GridViewColumn Header="IP" DisplayMemberBinding="{Binding CustomerIP}"/>
<GridViewColumn Header="Host Name" DisplayMemberBinding="{Binding HostName}"/>
<GridViewColumn Header="MAC" DisplayMemberBinding="{Binding MAC}"/>
<GridViewColumn Header="Avg. Ping Time" DisplayMemberBinding="{Binding time}"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</TabItem>
<TabItem Header="tabItem3" Name="tabItem3">
<Grid Height="307" />
</TabItem>
</TabControl>
<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="330,408,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
<Button Content="Next" Height="23" HorizontalAlignment="Right" Margin="0,408,12,0" Name="button2" VerticalAlignment="Top" Width="75" Click="button2_Click" />
<Button Content="Back" Height="23" HorizontalAlignment="Left" Margin="411,408,0,0" Name="button3" VerticalAlignment="Top" Width="75" IsEnabled="False" />
<Rectangle Height="0" HorizontalAlignment="Left" Margin="13,40,0,0" Name="rectangle2" Stroke="Black" VerticalAlignment="Top" Width="453" />
<ProgressBar Height="23" HorizontalAlignment="Left" Margin="5,408,0,0" Name="progressBar1" VerticalAlignment="Top" Width="319" Visibility="Hidden" />
<Button Content="Remove" Height="23" HorizontalAlignment="Left" Margin="486,363,0,0" Name="button4" VerticalAlignment="Top" Width="75" IsEnabled="False" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="15,363,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="162,363,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" />
<Label Content="To" Height="28" HorizontalAlignment="Right" Margin="0,360,421,0" Name="label1" VerticalAlignment="Top" />
<Button Content="Search" Height="23" HorizontalAlignment="Left" Margin="288,363,0,0" Name="button5" VerticalAlignment="Top" Width="75" Click="button5_Click" />
</Grid>

如果您需要我的 C# 代码来解决这个问题,我可以通过电子邮件将其发送给您,但是将代码放到网络上是违反公司政策的(而且 我喜欢我的工作... 我不想被解雇)

请记住,我通常使用 VB.net 进行开发,而 C#.net 对我来说非常陌生,因此如果您能为初学者详细说明您的解释,我们将不胜感激。


c#.netvs2010Windows Vista x64英特尔酷睿 2 四核

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com