How to use a type in attachedBindableProperty in xaml?

尼龟 杰 190 Reputation points
2024-01-19T03:51:34.0233333+00:00
public class LayoutHelper<T>
{
     public static readonly BindableProperty ItemSourceProperty = BindableProperty.CreateAttached("ItemSource", typeof(ObservableCollection<T>), typeof(LayoutHelper<T>), null);
....
}


In C# like:

        Extensions.LayoutHelper<string>.SetItemSource(hfl, historickeys); 

But how to use it in xaml:

        <Setter Property="extensions:LayoutHelper<string(this throw a error)>.ItemSource" .../> 

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,578 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,995 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
814 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.