0
用戶控件包含一些CustomControls與「國家」財產如何知道UserControl內的哪個元素改變了屬性?
<UserControl x:Class="MyNamespace.MyUserControl"
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="133" d:DesignWidth="175"
x:Name="my_user_control">
<Canvas>
<c:Led State="{Binding SegmentState, Mode=TwoWay}"/>
<c:Led State="{Binding SegmentState, Mode=TwoWay}"/>
<c:Led State="{Binding SegmentState, Mode=TwoWay}"/>
</Canvas>
SegmentState是一個依賴屬性與PropertyChangedCallback
public static DependencyProperty SegmentStateProperty =
DependencyProperty.Register("SegmentState", typeof(bool), typeof(MyUserControl),
new FrameworkPropertyMetadata(false, new PropertyChangedCallback(SegmentStateChanged)));
但是這裏面SegmentStateChanged我找不到哪一個LED的更改的屬性。有什麼方法可以找到?