バインドに問題があり、困惑しています。初めて Building プロパティを設定すると、TitleRasedText
オブジェクトのテキストが期待どおりに設定されます。ただし、Building プロパティに新しい値を設定しても、Title オブジェクトのテキスト フィールドは古い値のままです。理由はありますか?
public static readonly DependencyProperty buildingProperty = DependencyProperty.Register
(
"building",
typeof(string),
typeof(FloorPlan),
new PropertyMetadata((d,e) =>
{
try
{
(d as FloorPlan).BuildingChanged();
} catch {}
}
));
public string Building
{
get { return (string)GetValue(buildingProperty); }
set { SetValue(buildingProperty, value); }
}
private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
{
//Code...
Binding binding = new Binding();
binding.Source = Building;
binding.Mode = BindingMode.OneWay;
Title.SetBinding(TextControls.RaisedText.TextProperty, binding);
//Code...
}