#1.使用Blend 设计控件
<UserControl x:Class="WpfApp25.UserControl1"
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"
xmlns:local="clr-namespace:WpfApp25"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<local:StatusColorConverter x:Key="statusColorConverter"></local:StatusColorConverter>
</UserControl.Resources>
<Grid>
<Ellipse HorizontalAlignment="Left" Height="100" Stroke="#FFF5F2F2" VerticalAlignment="Top" Width="100" StrokeThickness="5"
Fill="{Binding StatusP, Converter={StaticResource statusColorConverter},UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserControl1}}}">
</Ellipse>
</Grid>
</UserControl>
#2.给控件添加自定义属性
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System