Use of Microsoft.Xaml.Behaviors within the use of a WPF custom-control property

Apologies for the length of this question, but it is rather intricate.
There is a lot of code around this, so I am only showing the code related to the problem.
I am using Loaded as the event, but the problem is the same regardless of which event I try.

I have a custom-control that defines a public FrameworkElement property.
When the custom-control is used, you can set this property on the control to a Grid, for example, and populate that with whatever you want.
Within the custom-control itself, the property is bound as the Content of a ContentPresenter.
This works fine.

This is being used to present a number of different objects, using a common look.

The problem comes when I try to use any of the interaction features inside controls in the CustomControlContent propery.

This is the property defined in the code-behind of the custom-control.

public class CustomControlClass : Control
{
...
    public FrameworkElement CustomControlContent
    {
        get => (FrameworkElement)GetValue(CustomControlContentProperty);
        set => SetValue(CustomControlContentProperty, value);
    }
    public static readonly DependencyProperty CustomControlContentProperty =
        DependencyProperty.Register(nameof(CustomControlContent),
            typeof(FrameworkElement), typeof(CustomControlClass)
            , new PropertyMetadata(null));
...
}

Within the custom-control XAML, this property is bound like this

...
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
...

<Grid IsSharedSizeScope="True">
...
    !!! This EvenTrigger in the custom-control itself, works. !!!
    <b:Interaction.Triggers>
        <b:EventTrigger EventName="Loaded" >
            <b:CallMethodAction MethodName="Loaded" TargetObject="{Binding}" />
        </b:EventTrigger>
    </b:Interaction.Triggers>
...
    <Border Grid.Row="1">
        <ContentPresenter Content="{TemplateBinding CustomControlContent}" />
    </Border>
</Grid>
...

In the TabItem where this custom control is used, the XAML looks like this. I had added a couple of CallMethodActions to demonstrate where they work and where they do not. It is as if the interactions XAML is simply being ignored. For example, if I use a method name that does not exist, I get a missing method exception (naturally) where it is working, but nothing at all where it is not. I have tried an InvokeComamandAction and a Behavior which are also ignored, so it is not just the CallMethodAction that is the problem.

...
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
...

<controls:CustomControlClass>
    !!! This works !!!
    <b:Interaction.Triggers>
        <b:EventTrigger EventName="Loaded" >
            <b:CallMethodAction MethodName="CustomControlClassLoaded" TargetObject="{Binding}" />
        </b:EventTrigger>
    </b:Interaction.Triggers>

    <controls:CustomControlClass.CustomControlContent>
    
        !!! When I put this in the XAML, intellisense tells me "A properyy element cannot be the direct content of another property element" !!!
        <b:Interaction.Triggers>
            <b:EventTrigger EventName="Loaded" >
                <b:CallMethodAction MethodName="CustomControlLoaded" TargetObject="{Binding}" />
            </b:EventTrigger>
        </b:Interaction.Triggers>
        
        <Grid>
        
            !!! This is apparently completely ignored - no intellisense complaints and the containing dialog is shown without problems, even though GridLoaded does not exist
            !!!
            <b:Interaction.Triggers>
                <b:EventTrigger EventName="Loaded" >
                    <b:CallMethodAction MethodName="GridLoaded" TargetObject="{Binding}" />
                </b:EventTrigger>
            </b:Interaction.Triggers>
...

Can anyone suggest how I can get these triggers/Behaviour to work?

I have tried adding the b names-space in the Grid itself, but that makes no difference.

New contributor

David Richards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật