11
My form WPF
works perfectly, but in a ComboBox
specific, after the action of selecting, the form is going behind all the windows, without further explanation, and this does not happen in any other form, would someone explain to me why?
The image before clicking on ComboBox
:
My ComboBox
:
<ComboBox Name="CbAnimalSpecie" Grid.Column="1" Grid.Row="3" Height="25" Width="130" Margin="100,0,250,0" ItemsSource="{Binding Path=AnimalSpecies}" SelectedItem="{Binding Animal.AnimalSpecie}" SelectedValuePath="Id" DisplayMemberPath="Name">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding GetAllAnimalBreedsByAnimalSpecieCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
UPDATING
As requested, follow my View
processing:
protected Helper.Views.ProcessingView ShowProcessing(Window ownerView)
{
try
{
var processingView = new Helper.Views.ProcessingView();
processingView.Owner = ownerView;
processingView.Show();
ownerView.IsEnabled = false;
return processingView;
}
catch (Exception)
{
throw;
}
}
protected void CloseProcessing(Window ownerView, Window processingView)
{
try
{
ownerView.IsEnabled = true;
processingView.Hide();
processingView.Close();
}
catch (Exception)
{
throw;
}
}
Man Command
:
public ICommand GetAllAnimalBreedsByAnimalSpecieCommand
{
get { return _getAllAnimalBreedsByAnimalSpecieCommand ?? (_getAllAnimalBreedsByAnimalSpecieCommand = new DelegateCommand(GetAllAnimalBreedsByAnimalSpecie)); }
}
And finally, my method:
private void GetAllAnimalBreedsByAnimalSpecie()
{
try
{
var processingView = base.ShowProcessing(this.AnimalUpdateView);
this.AnimalBreedsOriginal = new Repository.AnimalBreed().GetAllAnimalBreeds();
this.AnimalBreeds = new Repository.AnimalBreed().GetAllAnimalBreeds(T => T.AnimalSpecieId == this.Animal.AnimalSpecie.Id);
base.CloseProcessing(this.AnimalUpdateView, processingView);
}
catch
{
throw;
}
}
UPDATE 2
Okay, I found part of the Form problem, it’s this snippet of code:
private void GetAllAnimalBreedsByAnimalSpecie()
{
try
{
var processingView = base.ShowProcessing(this.AnimalUpdateView);
.
.
.
base.CloseProcessing(this.AnimalUpdateView, processingView);
}
catch
{
throw;
}
}
But as I said earlier, this chunk works perfectly on all the software, because right now it has this strange behavior?