質問

私は2つのテキストボックス、請求先住所フィールド用と配送先住所フィールドのための1つを持っています。ユーザー請求先住所のテキストボックスにタイプの何かが配送先住所のテキストボックスが原因以下の結合のシナリオに同じ値を取得する場合:

<TextBox Name="txtBillingAddress" Text="{Binding BillingAddress, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

<TextBox Name="txtShippingAddress">
   <TextBox.Text>
      <MultiBinding Converter="{StaticResource AddressConverter}">
         <Binding ElementName="txtBillingAddress" Path="Text" Mode="OneWay" />
         <Binding Path="ShippingAddress" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" />
      </MultiBinding>
   </TextBox.Text>
</TextBox>

このポイントまで正常に動作します。私はまた、請求先住所があると配送先住所が私のデータベース・エンティティにバインドすることにしたいです。私の問題は、配送先住所のテキストボックスは、請求先住所で入力されているものが移入されている間、この問題が発生している間、ConvertBack方法が解雇されていないということです。何かが配送先住所のテキストボックスに直接入力された場合にのみ解雇されます。

私は何をしないのですか?

役に立ちましたか?

解決

多分これはあなたのViewModelに実装する方が簡単でしょう?

public string BillingAddress{
    set{
        billingAddress = value;
        firePropertyChanged("BillingAddress");
        if(string.isNullOrEmpty(ShippingAddress)
        {
            ShippingAddress = value; //use the property to ensure PropertyChanged fires
        }
    }
    get{ return billingAddress; }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top