This is something that's driving me crazy.. I have a WPF project which is already in production. Now, I have to make some fix for which I have to set x:Name property to couple of controls. But, when I set x:Name property for any control, it's throwing XamlParser exception (inner exception says cannot cast type XXX to type Button where XXX is type of control for which I am setting x:Name property).
It also shows an additional error like,
Additional information: Set connectionId threw an exception.
I have closed and reopened Visual Studio; I have cleaned the solution and rebuilt many times; but no use.
Can anybody let mw know what's going on?
Here is the code - I have just added x:Name = "PnlUpDown" to stack panel.
<StackPanel Name="PnlUpDown" VerticalAlignment="Center" Grid.Column="3">
<Button x:Name="BtnMoveUp" Padding="3,5" Margin="5,0,0,3" Tag="MOVEUP" >
<Polygon Points="0,15 5,0,10,15" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}"/>
</Button>
<Button x:Name="BtnMoveDown" Padding="3,5" Margin="5,3,0,0" Tag="MOVEDOWN" >
<Polygon Points="0,0 5,15,10,0" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}"/>
</Button>
</StackPanel>
Now.. I find that not only x:Name property.. It's not allowing me to set any other property to any control - In general, if I modify my XAML it's throwing error..!!!!!!! For everything it's throwing Set Connection Id error :(