I am working with ComponentOne WPF Controls with MVVM Pattern.
I have the following in my ViewModel:
public ICommand ClientsEnter
{
get
{
if (this.m_ClientsEnter == null)
{
this.m_ClientsEnter = new DelegateCommand<string>(ClientsLostFocusExecute, ClientsLostFocusCanExecute);
}
return m_ClientsEnter;
}
}
And an observable collection :
public ObservableCollection<Client> Clients
{
get { return m_Clients; }
set
{
m_Clients = value;
RaisePropertyChanged("Clients");
}
}
in Xaml I have Added A ComponentOne Combo Box where I can enter ClientName
Or ID
and press enter to fire Event to execute ClientsEnter
Command:
<Custom1:C1ComboBox Grid.Row="2" Grid.Column="1" Height="24" Name="cmbClients" HorizontalAlignment="Left" VerticalAlignment="Center"
ItemsSource="{Binding Clients, Mode=OneWay}" SelectedValuePath="ClientID" DisplayMemberPath="NameE" IsEditable="True"
Text="Enter Client Name Or ID" SelectedValue="{Binding Path=Filter.ClientID, Mode=TwoWay}" MinWidth="150" Margin="0,2" Width="189">
<i:Interaction.Triggers>
<ei:KeyTrigger Key="Tab" FiredOn="KeyUp" ActiveOnFocus="True" SourceName="cmbClients">
<i:InvokeCommandAction Command="{Binding ClientsEnter, Mode=OneWay}" CommandParameter="{Binding Text,ElementName=cmbClients}" CommandName="KeyDown"/>
</ei:KeyTrigger>
</i:Interaction.Triggers>
</Custom1:C1ComboBox>
I need to know why it doesn't work, after pressing enter the clientID
Disappears and nothing happens. Even the text="Enter Client Name Or ID"
doesn't appear! Any ideas?