Tenho um WPF que está da seguinte forma:
<ComboBox Name="comboBoxRemetente" VerticalContentAlignment="Center" Margin="5" Grid.ColumnSpan="20"
ItemsSource ="{Binding Path=Lista, Mode = TwoWay}"
SelectedValue="{Binding Path=Model, Mode = TwoWay}"
DisplayMemberPath="Remetente"
IsSynchronizedWithCurrentItem="True"
SelectedIndex="0"
>
</ComboBox>
<DataGrid Name="GridLista"
Grid.ColumnSpan="20"
Margin="5"
Grid.RowSpan="11"
Grid.Row="8"
CanUserAddRows="False"
CanUserReorderColumns="True"
AutoGenerateColumns="False"
SelectionUnit="FullRow"
SelectionMode="Extended"
ItemsSource="{Binding Path=Lista}"
SelectedValue="{Binding Path=Model, Mode = TwoWay}"
IsReadOnly="True"
>
Entao, Quando inicio a tela eu carrego a lista PAI e ela preenche os campos quase que tudo corretamente. Meu problema é:
Tenho esse combobox:
<ComboBox Name="comboBoxCartao" Grid.Row="7" Grid.ColumnSpan="8" VerticalContentAlignment="Center" Padding="0" Margin="5" Grid.Column="2"
ItemsSource ="{Binding Path=CartaoBean.Lista, Mode = TwoWay}"
SelectedValue="{Binding Path=Model.Cartao, Mode = TwoWay}"
DisplayMemberPath="ToComboBox"
IsSynchronizedWithCurrentItem="True"
SelectedIndex="0"
>
</ComboBox>
Esse ultimo combobox carrega uma lista de FILHOS, na CLASSE PAI eu tenho setado esse um filho, então preciso que ao selecionar um PAI, ele também selecione o FILHO nesse combobox, poderiam me ajudar onde estou errando? rs
Metodo Hash do Cartão:
public override bool Equals(object obj)
{
var cart = obj as CartaoPostagemModel;
if (cart == null) return false;
return cart.Cartao == this.Cartao;
}
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = 17;
// Suitable nullity checks etc, of course :)
hash = hash * 23 + Id.GetHashCode();
hash = hash * 23 + Cartao.GetHashCode();
hash = hash * 23 + Contrato.GetHashCode();
return hash;
}
}