General behavior

I would like to create a common behavior. My problem is the general ad in XAML.

    public class GenericBehavior<T> : Behavior<DataGrid>
        where T : class 
    {
    }

I cannot use x: TypeArguments because I do not have a free XAML file.

In WPF and when setting up the .NET Framework 4, you can use the XAML 2009 functions along with x: TypeArguments, but only for free XAML (which is not linked with XAML). Compiled XAML for WPF and the BAML form of XAML does not currently support XAML 2009 keywords and features

I found some workaround with MarkupExtension, but does not work with behavior.

In my current solution, I am adding behavior to the code .

Any idea?

+2

Source: https://habr.com/ru/post/1542949/


All Articles