1
私は顧客のための簡単なアドレス形式を持っています。国と州のコンボボックスはListCollectionViewsにリンクされています。これは、ユーザーが国の設定を変更するときに、状態リストをモデルビューでフィルタリングすることができます。問題は、以前の情報がフォームにロードされたときに、状態コンボボックスにデータがあっても空白になってしまうことです。彼らはxamlに置かれているために秩序があるようです。状態の前に国のコンボボックスを置くと、うまくいけば、国は状態の後に来たいです。 xamlのレイアウトを元のままにする方法はありますか?国のコンボボックスは状態の前に処理されていますか?WPF Xaml処理注文
XAML:
<StackPanel Orientation="Horizontal">
<TextBlock Height="23" Name="tbkMailState" Text="State/Province:" Width="80" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2" Foreground="Black" />
<ComboBox Height="23" Name="cmbMailState" Width="200" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2" Foreground="Black" ItemsSource="{Binding GeoStateListMail}" SelectedValue="{Binding OpenEntityListing.EntityMailAddress.GeoState_Id}" DisplayMemberPath="Name" SelectedValuePath="Id" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Height="23" Name="tbkMailCountry" Text="Country:" Width="80" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2" Foreground="Black" />
<ComboBox Height="23" Name="cmbMailCountry" Width="200" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2" Foreground="Black" ItemsSource="{Binding GeoCountryListMail, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValue="{Binding OpenEntityListing.EntityMailAddress.GeoCountry_Id}" DisplayMemberPath="Name" SelectedValuePath="Id" IsSynchronizedWithCurrentItem="True" />
</StackPanel>
のViewModelフィルタ:
public void GeoCountry_CurrentChanged(object sender, EventArgs e)
{
GeoStateList.Filter = item =>
{
GeoState vitem = item as GeoState;
if ((OpenEntityListing == null) || (vitem == null))
{
return false;
}
return vitem.GeoCountry_Id == OpenEntityListing.EntityAddress.GeoCountry_Id;
};
}
こんにちは@Erno、私はRaisePropertyChangedをフィルタの実行後に使用しようとしましたが、何もしません。そのバインディングを再評価する必要があるように思えます。 – chinupson
@chinupson、私はあなたがあなたのビューモデルでそれを解決しなければならないと本当に思っていますが、当面はあなたを見てみることができます:http://social.msdn.microsoft.com/forums/en-US/wpf/thread/2ee69a80-c3ae-486b-a3d3-9f207c7e93f4 –
@chinupson、http://stackoverflow.com/questions/656552/is-it-possible-to-refresh-wpf-data-bindings –