L
L
LiptonOlolo2020-01-30 09:39:49
WPF
LiptonOlolo, 2020-01-30 09:39:49

How to bind Generic VM?

Good day.
There is an interface of the base ViewModel:

interface IBaseViewModel<T>
{
  ICommand AddCommand { get; }

  ICommand<T> EditCommand { get; }

  ICommand<T> DeleteCommand { get; }
}


I'm trying to bind through this interface, but it doesn't work:
<Button Command="{Binding Path=(vm:IBaseViewModel`1.AddCommand)}"/> 

<Button Command="{Binding Path=(vm:IBaseViewModel`1.EditCommand)}"/>


The first button - everything is OK (although during operation it throws an error: Unexpected character "`" in the line "vm:IBaseViewModel`1"), the second one throws an error:
5e327a1d66a9e782795371.jpeg
Is it somehow solved or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2020-01-30
@yarosroman

Binding is carried out to the class, properties are bound through reflection, you just need to specify the member of the class to which you bind.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question