我創建usercontrol 當我將它添加到我的wpf窗口獲取此錯誤: 錯誤47標記'UserControl1'不存在於XML名稱空間'clr-namespace:WPFTestApp;程序集= WPFTestApp'中。線115位置14Wpf用戶控制錯誤
<Grid.Background>
<ImageBrush ImageSource="background.jpg" TileMode="FlipXY" Stretch="None" Viewbox="0,0,1,1" Viewport="0,0,0.3,0.3" />
</Grid.Background>
<DockPanel Name="dockPanel1" Margin="20,20,5,5 " LastChildFill="True">
<StackPanel Name="stackPanel1" DockPanel.Dock="Left" Width="200" >
<Grid Name="grid1" Width="200" >
<Grid.RowDefinitions>
<RowDefinition Height="270" />
<RowDefinition Height="155"/>
<RowDefinition Height="195" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Canvas IsEnabled="True" Grid.Column="0" Grid.Row="0" >
<Rectangle Width="200" Height="260" RadiusX="10" RadiusY="10" Fill="White" Stroke="Silver" Opacity="0.5"/>
<ContentControl Canvas.Left="196" Canvas.Top="245" Height="50" Name="contentControl1" Width="100">
<Viewport3D Name="viewport3D1" />
</ContentControl>
</Canvas>
<Canvas Grid.Row="1">
<Rectangle Width="200" Height="145" RadiusX="10" RadiusY="10" Fill="White" Stroke="Silver" Opacity="0.5"/>
<StackPanel Width="200" Height="145" VerticalAlignment="Top">
<Label Height="35" Width="120" FontSize="12" FontWeight="Bold">Animation Settings</Label>
<Grid Name="grid10" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="76" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0">Animate</Label>
<CheckBox Name="animateCheckBox" Grid.Column="1" Margin="0,7,0,0" Checked="animateCheckBox_Checked" Unchecked="animateCheckBox_Unchecked"></CheckBox>
</Grid>
<Grid Name="grid11" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="76" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0">Show Circles</Label>
<CheckBox Name="showCirclesCheckBox" Grid.Column="1" Margin="0,7,0,0" IsEnabled="False" ></CheckBox>
</Grid>
<Grid Name="grid12" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="76" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" >Velocity</Label>
<Label Name="velocityLabel" Grid.Column="1" Content="{Binding Value, ElementName=velocitySlider}"></Label>
</Grid>
<Slider Height="30" Name="velocitySlider" Width="175" Minimum="1" Maximum="50" SmallChange="1" LargeChange="10" Value="50" IsEnabled="{Binding IsChecked, ElementName=animateCheckBox}" IsSnapToTickEnabled="True" />
</StackPanel>
</Canvas>
<Canvas Name="o" IsEnabled="True" Grid.Column="0" Grid.Row="2">
<Rectangle Width="200" Height="195" RadiusX="10" RadiusY="10" Fill="White" Stroke="Silver" Opacity="0.5"/>
<StackPanel Width="200" Height="195" HorizontalAlignment="Center" VerticalAlignment="Top">
<Label Height="35" Width="93" FontSize="12" FontWeight="Bold">Brush Settings</Label>
<Grid Name="grid7" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0">Line Width</Label>
<Label Name="widthLabel" Grid.Column="1" Content="{Binding Value, ElementName=widthSlider}"></Label>
</Grid>
<Slider Height="30" Name="widthSlider" Width="175" Minimum="1" Maximum="20" SmallChange="1" LargeChange="10" IsSnapToTickEnabled="True" />
<Grid Name="grid8" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
</Grid>
<Grid Name="grid9" Width="200" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0">Brush Color</Label>
<StackPanel Name="colorPanel" Grid.Column="1" Background="Red" Width="40" Height="40" HorizontalAlignment="Left" Margin="5,0,0,0"></StackPanel>
<Button Grid.Column="1" Width="25" Height="25" Name="colorButton" Margin="5,0,0,0" Click="colorButton_Click">...</Button>
</Grid>
</StackPanel>
</Canvas>
</Grid>
</StackPanel>
<my:UserControl1 Height="100" Name="userControl11" Width="200" />
</DockPanel>
<Button Name="button1" Width="80" HorizontalAlignment="Left" Margin="23,0,0,14" Click="button1_Click" Height="23" VerticalAlignment="Bottom">
<StackPanel Height="Auto" HorizontalAlignment="Left" Orientation="Horizontal" Width="Auto">
<Image Height="16" Source="draw.png" Stretch="Fill" Width="16" />
<TextBlock FontSize="12" Margin="10,0,50,0" Text="SeLect" VerticalAlignment="Center" /></StackPanel>
</Button>
</Grid>