세로 StackPanel이 있는데 부모 StackPanel의 ActualWidth에 바인드 된 .X2 값을 가진 Line-child를 포함하고 싶습니다. 같은 뭔가 :길이가 부모 Panel의 ActualWidth 속성 (데이터 바인딩)에 자체 조정
StackPanel sp = new StackPanel();
sp.Orientation = Orientation.Vertical;
(...)
Line line = new Line();
line.X1 = 0;
line.X2 = <Some binding to sp.ActualWidth>;
// line.Y1 = line.Y2 - will it set it's value to 0 by default?
line.StrokeThickness = 2;
(...)
sp.Children.Add(line);
나는에서 INotifyPropertyChanged 인터페이스를 사용해야합니까? 이것이 가장 적절한 방법입니까?