xamlParseException的窗口中启动 [英] xamlParseException on window launch
问题描述
我收到以下错误,当我告诉从另一个窗口,这个窗口在我的应用程序:
I get the following error when I show this window from another window in my application:
XamlParseException发生'设置的ConnectionId抛出一个异常。'
行号'4'和线位置25
XamlParseException occurred 'Set connectionId threw an exception.' Line number '4' and line position '25'.
随着内部异常:
{无法投型System.Windows.Controls.TabControl'
键入WpfApplication1.Window1'的对象。}
{"Unable to cast object of type 'System.Windows.Controls.TabControl' to type 'WpfApplication1.Window1'."}
我的XAML代码如下:
My xaml code is as follows:
<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#代码要弄清楚这个问题,我可以通过电子邮件发送给你,但它是违反公司政策把这些代码在网络上(和<击>我喜欢我的工作...... 罢>我不想被炒鱿鱼)
If you need my C# code to figure out this problem I can Email it to you, but it is against company policy to put that code on the web (and I enjoy my job... I dont want to get fired)
请记住,我normaly在VB.net开发,和C#.NET是非常新的给我,如果你能请详细说明您是初学者,这将是解释赞赏。
Please keep in mind that I normaly develop in VB.net, and C#.net is very new to me, so if you could please detail your explanations for a beginner that would be appreciated.
C#.NET
VS2010
于Windows Vista x64
英特尔酷睿2四
c#.net vs2010 Windows Vista x64 Intel Core 2 Quad
推荐答案
尝试从重建Solution Explorer中的完整的解决方案。
Try Rebuilding the complete solution from Solution Explorer.
这篇关于xamlParseException的窗口中启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!