我有以下代码:XAML:
<UserControl x:Class="RBSoft.WPF.RedConsoleViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="355" d:DesignWidth="691" Name="ConsoleUI_Control" KeyDown="ConsoleUI_Control_KeyDown">
<Grid Name="_Layout">
<Rectangle Name="BackgroundLayout">
<!--...-->
</Rectangle>
</Grid>
</UserControl>
代码:
public Rectangle IBackground
{
get { return this.BackgroundLayout; }
set { this.BackgroundLayout = value; }
}
我要做的是从 XAML 编辑器中编辑矩形(BackgroundLayout),如下所示:
<Window x:Class="LifeEnvironment.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="1064" Width="910"
xmlns:my="clr-namespace:RBSoft.WPF;assembly=RBSoft.WPF"
WindowStyle="None"
WindowState="Maximized"
WindowStartupLocation="CenterScreen">
<Grid>
<my:userControlTest>
<my:userControlTest.IBackground>
<Background ...>
</my:userControlTest.IBackground>
</my:userControlTest>
</Grid>
</Window>
但是我无法访问这个,我需要做什么?