it compiles and doesn't give me a runtime error but now the textblock is not filled with a string of the selected checkboxes when I select them inside the control.
here is the code:

<Window.Resources>
        <resources:IsCheckedConverter x:Key="IsCheckedConverter"/>
        <resources:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </Window.Resources>
    <Grid Margin="0,0,-6,-4" Height="668" VerticalAlignment="Top">
        <Grid.Resources>
            <Style TargetType="resources:CheckBoxComboBox">
                <Setter Property="Background" Value="White"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="resources:CheckBoxComboBox">
                            <Grid>
                                <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                    <Grid>
                                        <ToggleButton x:Name="ToggleButton" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Focusable="False" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press">
                                            <ToggleButton.Style>
                                                <Style TargetType="ToggleButton">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="IsTabStop" Value="False"/>
                                                    <Setter Property="Focusable" Value="False"/>
                                                    <Setter Property="ClickMode" Value="Press"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="ToggleButton">
                                                                <Grid>
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition/>
                                                                        <ColumnDefinition Width="20"/>
                                                                    </Grid.ColumnDefinitions>
                                                                    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"/>
                                                                    <Path x:Name="Arrow" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z">
                                                                        <Path.Fill>
                                                                            <SolidColorBrush Color="Black" />
                                                                        </Path.Fill>
                                                                    </Path>
                                                                </Grid>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </ToggleButton.Style>
                                        </ToggleButton>
                                        <TextBlock Text="{Binding SelectedItems, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource IsCheckedConverter}}" Margin="3,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Visibility="{Binding AreAnyItemsSelected, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                    </Grid>
                                </Border>
                                <Popup x:Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
                                    <Border x:Name="DropDownBorder" Background="White" BorderThickness="1" BorderBrush="Gray">
                                        <ScrollViewer x:Name="ScrollViewer" CanContentScroll="True">
                                            <ItemsPresenter />
                                        </ScrollViewer>
                                    </Border>
                                </Popup>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>

public class CheckBoxComboBox : ComboBox
    {
        public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register("SelectedItems", typeof(IEnumerable), typeof(CheckBoxComboBox));
        public static readonly DependencyProperty AreAnyItemsSelectedProperty = DependencyProperty.Register("AreAnyItemsSelected", typeof(bool), typeof(CheckBoxComboBox));

        public IEnumerable SelectedItems
        {
            get => (IEnumerable)GetValue(SelectedItemsProperty);
            set => SetValue(SelectedItemsProperty, value);
        }

        public bool AreAnyItemsSelected
        {
            get => (bool)GetValue(AreAnyItemsSelectedProperty);
            set => SetValue(AreAnyItemsSelectedProperty, value);
        }

        static CheckBoxComboBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(CheckBoxComboBox), new FrameworkPropertyMetadata(typeof(CheckBoxComboBox)));
        }

        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            foreach (object selectedItem in e.AddedItems)
            {
                if (selectedItem is SelectedItemsConverter item)
                {
                    item.IsChecked = true;
                }
            }

            foreach (object selectedItem in e.RemovedItems)
            {
                if (selectedItem is SelectedItemsConverter item)
                {
                    item.IsChecked = false;
                }
            }
        }
    }

public class SelectedItemsConverter : DependencyObject
    {
        public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(
            "IsChecked",
            typeof(bool),
            typeof(SelectedItemsConverter));

        public bool IsChecked
        {
            get => (bool)GetValue(IsCheckedProperty);
            set => SetValue(IsCheckedProperty, value);
        }

        public object Content { get; set; }
    }

public class CheckBoxComboBoxItemTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ItemTemplate { get; set; }

        public DataTemplate SelectedItemTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            return container is FrameworkElement _ && item is SelectedItemsConverter checkBoxComboBoxItem
                ? checkBoxComboBoxItem.IsChecked ? SelectedItemTemplate : ItemTemplate
                : base.SelectTemplate(item, container);
        }
    }

public class BooleanToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool isVisible && isVisible)
            {
                return Visibility.Visible;
            }

            return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

public class IsCheckedConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value is IEnumerable selectedItems ? string.Join(", ", selectedItems.Cast<object>()) : string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }