I am getting this exception:
"Cannot resolve TargetName userControl" when I try to set the DataContext.Here's the xaml:
<UserControl x:Class="TagCheckView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:System="clr-namespace:System;assembly=mscorli开发者_开发知识库b"
mc:Ignorable="d" Margin="3,0">
<Grid x:Name="LayoutRoot" >
<VisualStateManager.VisualStateGroups>
<!-- snip -->
</VisualStateManager.VisualStateGroups>
<TextBlock Text="{Binding Tag.Name, Mode=TwoWay, TargetNullValue='Value is Null'}"
TextWrapping="Wrap" Foreground="Red" />
</Grid>
</UserControl>
And the code that throws the exception:
TagCheckView tagCheckView = new TagCheckView();
tagCheckView.DataContext = m.ViewModel; /* boom */
Thanks for any hints on what's going wrong...
精彩评论