Telerik Forums
UI for WPF Forum
0 answers
18 views

I am facing an issue while loading the docking window saved XML to load. I have cross-checked XML files and found that there is no error in xml file. But while loading into an application it will show a red color lock icon.

Secondly, additional empty tabs will be shown along with other tabs. I have attached the screeshot. In screenshot, it has fixed window. But red icon can be seen in docking window also.

There are scenarios where empty tabs will be seen in mid of multiple tabs. But data collection don't have additional records.

Amit
Top achievements
Rank 1
 asked on 25 Feb 2025
1 answer
27 views
I'm experiencing an issue with RadTabControl where I cannot navigate between tabs after implementing a custom template for RadTabItem. When I remove the custom template, the navigation works fine, but as soon as I add the template back, I lose the ability to switch between tabs.
Below is my xaml code
<UserControl
    x:Class="agent_ui.Views.SettingsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:agent_ui.Views"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    d:DesignHeight="1450"
    d:DesignWidth="800"
    mc:Ignorable="d">

    <UserControl.Resources>

        <Style TargetType="telerik:RadButton">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Background" Value="#ff6c1e" />
            <Setter Property="Padding" Value="10,5" />
            <Setter Property="Margin" Value="0,0,0,10" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="MinWidth" Value="120" />
            <Setter Property="MaxWidth" Value="160" />
        </Style>

        <Style TargetType="telerik:RadToggleButton">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Padding" Value="10,5" />
        </Style>

        <Style TargetType="telerik:RadTabControl">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadTabControl">
                        <Grid Background="#1E1E1E">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <!--  Tab Header Panel  -->
                            <Border
                                Grid.Row="0"
                                MinHeight="45"
                                Background="#252525">
                                <TabPanel
                                    x:Name="HeaderPanel"
                                    IsItemsHost="True"
                                    KeyboardNavigation.TabIndex="1" />
                            </Border>

                            <!--  Content Panel  -->
                            <Border
                                x:Name="ContentPanel"
                                Grid.Row="1"
                                Background="Transparent"
                                BorderThickness="0"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                KeyboardNavigation.TabIndex="2">
                                <ContentPresenter
                                    x:Name="PART_SelectedContentHost"
                                    Margin="2"
                                    ContentSource="SelectedContent" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="telerik:RadListBox">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="#2E2F45" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="Margin" Value="0" />
        </Style>
        <Style TargetType="telerik:RadTabItem">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Padding" Value="20,10" />
            <Setter Property="MinHeight" Value="45" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Foreground" Value="#808080" />
            <!--  Set all directional templates to ensure proper functionality  -->
            <Setter Property="TopTemplate">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadTabItem">
                        <Grid>
                            <Border
                                x:Name="Border"
                                Padding="{TemplateBinding Padding}"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="2" />
                                    </Grid.RowDefinitions>

                                    <ContentPresenter
                                        x:Name="HeaderContentPresenter"
                                        Grid.Row="0"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        ContentSource="Header"
                                        RecognizesAccessKey="True" />

                                    <Rectangle
                                        x:Name="SelectionIndicator"
                                        Grid.Row="1"
                                        Height="2"
                                        Fill="#ff6c1e"
                                        Visibility="Collapsed" />
                                </Grid>
                            </Border>
                            <!--  Required parts for tab functionality  -->
                            <ContentPresenter
                                x:Name="PART_Content"
                                Margin="{TemplateBinding Padding}"
                                ContentSource="Content"
                                Visibility="Collapsed" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Foreground" Value="#FFFFFF" />
                                <Setter Property="Panel.ZIndex" Value="1" />
                                <Setter TargetName="SelectionIndicator" Property="Visibility" Value="Visible" />
                                <Setter Property="Background" Value="#2D2D2D" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="#2D2D2D" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <!--  Copy the same template for other directions  -->
            <Setter Property="BottomTemplate">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadTabItem">
                        <!--  Same template as TopTemplate  -->
                        <Grid>
                            <Border
                                x:Name="Border"
                                Padding="{TemplateBinding Padding}"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="2" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>

                                    <Rectangle
                                        x:Name="SelectionIndicator"
                                        Grid.Row="0"
                                        Height="2"
                                        Fill="#ff6c1e"
                                        Visibility="Collapsed" />

                                    <ContentPresenter
                                        x:Name="HeaderContentPresenter"
                                        Grid.Row="1"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        ContentSource="Header"
                                        RecognizesAccessKey="True" />
                                </Grid>
                            </Border>
                            <ContentPresenter
                                x:Name="PART_Content"
                                Margin="{TemplateBinding Padding}"
                                ContentSource="Content"
                                Visibility="Collapsed" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Foreground" Value="#FFFFFF" />
                                <Setter Property="Panel.ZIndex" Value="1" />
                                <Setter TargetName="SelectionIndicator" Property="Visibility" Value="Visible" />
                                <Setter Property="Background" Value="#2D2D2D" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="#2D2D2D" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid Margin="4">
        <Border
            Background="Transparent"
            BorderBrush="#2E2F45"
            BorderThickness="0"
            CornerRadius="5">
            <telerik:RadTabControl>
                <!--  Discovery Configuration Tab  -->
                <telerik:RadTabItem Header="Discovery Configuration">
                    <StackPanel Margin="20">
                        <TextBlock
                            Margin="0,0,0,20"
                            FontSize="18"
                            FontWeight="Bold"
                            Foreground="#ffffff"
                            Text="Add a new folder for discovery" />

                        <StackPanel Orientation="Horizontal">
                            <telerik:RadButton Command="{Binding SelectFolderClassificationCommand}">
                                <StackPanel Orientation="Horizontal ">
                                    <telerik:RadGlyph FontSize="16" Glyph="&#xe105;" />
                                    <TextBlock
                                        Margin="5,0,0,0"
                                        FontSize="18"
                                        Text=" Select Folder" />
                                </StackPanel>
                            </telerik:RadButton>
                            <TextBlock
                                Margin="10,0,0,0"
                                VerticalAlignment="Center"
                                Background="Gray"
                                Text="{Binding FolderPath}" />
                        </StackPanel>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0">
                                <TextBlock
                                    FontSize="18"
                                    Foreground="#ffffff"
                                    Text="Start Time" />
                                <telerik:RadDatePicker
                                    Margin="0,0,0,20"
                                    DisplayDate="{Binding DisplayTime}"
                                    SelectedDate="{Binding StartTime}" />
                            </StackPanel>

                            <StackPanel Grid.Column="1" Margin="10,0,0,0">
                                <TextBlock
                                    FontSize="18"
                                    Foreground="#ffffff"
                                    Text="End Time" />
                                <telerik:RadDatePicker
                                    DisplayDate="{Binding StartTime}"
                                    IsEnabled="{Binding IsStartTimeSelected}"
                                    SelectedDate="{Binding EndTime}" />
                            </StackPanel>
                        </Grid>

                        <TextBlock
                            Margin="0,0,0,10"
                            FontSize="18"
                            Foreground="#ffffff"
                            Text="Interval Time" />

                        <Border
                            BorderBrush="#2E2F45"
                            BorderThickness="1"
                            CornerRadius="5">
                            <Grid Margin="10,5">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <telerik:RadGlyph
                                    Grid.Column="0"
                                    Margin="0,0,10,0"
                                    FontSize="20"
                                    Foreground="#A7A3DC"
                                    Glyph="&#xe113;" />

                                <telerik:RadWatermarkTextBox
                                    Grid.Column="1"
                                    Width="600"
                                    Background="Transparent"
                                    BorderThickness="0"
                                    Text="{Binding IntervalTime, Mode=TwoWay}"
                                    WatermarkContent="Enter time in Mins..." />
                            </Grid>
                        </Border>

                        <telerik:RadButton
                            MinWidth="140"
                            MaxWidth="200"
                            Command="{Binding SelectFolderClassificationCommandAdd}">
                            <StackPanel Orientation="Horizontal">
                                <telerik:RadGlyph FontSize="16" Glyph="&#xe105;" />
                                <TextBlock
                                    Margin="5,0,0,0"
                                    FontSize="18"
                                    Text=" Add Folder path" />
                            </StackPanel>
                        </telerik:RadButton>

                        <TextBlock Foreground="Red" Text="{Binding DiscoveryError}" />

                        <TextBlock
                            FontSize="16"
                            Foreground="#A7A3DC"
                            Text="Add Your Folder and click scan for Discover your sensitive data" />

                        <telerik:RadListBox MaxHeight="300" ItemsSource="{Binding FolderClassifications}">
                            <telerik:RadListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="50" />
                                            <ColumnDefinition Width="20" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="210" />
                                            <ColumnDefinition Width="30" />
                                        </Grid.ColumnDefinitions>

                                        <telerik:RadButton
                                            Grid.Column="0"
                                            Command="{Binding RunClassification}"
                                            Content="Scan"
                                            FontSize="12" />

                                        <telerik:RadGlyph
                                            Grid.Column="1"
                                            FontSize="16"
                                            Glyph="&#xe8b7;" />

                                        <TextBlock
                                            Grid.Column="2"
                                            Margin="5,0"
                                            VerticalAlignment="Center"
                                            FontSize="12"
                                            Text="{Binding Source}" />

                                        <TextBlock
                                            Grid.Column="3"
                                            VerticalAlignment="Center"
                                            FontSize="12"
                                            Foreground="{Binding ClassificationStatusColor}"
                                            Text="{Binding ClassificationStatus}" />

                                        <telerik:RadButton Grid.Column="4" Command="{Binding DeleteCommand}">
                                            <telerik:RadGlyph FontSize="11" Glyph="&#xe10a;" />
                                        </telerik:RadButton>
                                    </Grid>
                                </DataTemplate>
                            </telerik:RadListBox.ItemTemplate>
                        </telerik:RadListBox>
                    </StackPanel>
                </telerik:RadTabItem>

                <!--  Control Configuration Tab  -->
                <telerik:RadTabItem Header="Control (File Activity) Configuration">
                    <StackPanel Margin="20">
                        <StackPanel Orientation="Horizontal">
                            <telerik:RadButton Command="{Binding SelectFolderCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <telerik:RadGlyph FontSize="16" Glyph="&#xe105;" />
                                    <TextBlock
                                        Margin="5,0,0,0"
                                        FontSize="18"
                                        Text=" Select Folder" />
                                </StackPanel>
                            </telerik:RadButton>
                            <TextBlock
                                Margin="10,0,0,0"
                                VerticalAlignment="Center"
                                Background="Gray"
                                Text="{Binding ControlFolderPath}" />
                        </StackPanel>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Column="0">
                                <TextBlock
                                    FontSize="18"
                                    Foreground="#ffffff"
                                    Text="Start Time" />
                                <telerik:RadDatePicker DisplayDate="{Binding DisplayTime}" SelectedDate="{Binding ControlStartTime}" />
                            </StackPanel>

                            <StackPanel Grid.Column="1" Margin="10,0,0,0">
                                <TextBlock
                                    FontSize="18"
                                    Foreground="#ffffff"
                                    Text="End Time" />
                                <telerik:RadDatePicker
                                    DisplayDate="{Binding ControlStartTime}"
                                    IsEnabled="{Binding IsControlStartTimeSelected}"
                                    SelectedDate="{Binding ControlEndTime}" />
                            </StackPanel>
                        </Grid>

                        <telerik:RadButton
                            MinWidth="140"
                            MaxWidth="200"
                            Command="{Binding SelectFolderCommandAdd}">
                            <StackPanel Orientation="Horizontal">
                                <telerik:RadGlyph FontSize="16" Glyph="&#xe105;" />
                                <TextBlock
                                    Margin="5,0,0,0"
                                    FontSize="18"
                                    Text=" Add Folder path" />
                            </StackPanel>
                        </telerik:RadButton>

                        <TextBlock Foreground="Red" Text="{Binding ControlError}" />

                        <TextBlock
                            FontSize="16"
                            Foreground="#A7A3DC"
                            Text="Add Your Folder and click scan for Monitoring your data" />

                        <telerik:RadListBox MaxHeight="350" ItemsSource="{Binding FolderMonitors}">
                            <telerik:RadListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="50" />
                                            <ColumnDefinition Width="20" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="210" />
                                            <ColumnDefinition Width="30" />
                                        </Grid.ColumnDefinitions>

                                        <telerik:RadToggleButton
                                            Grid.Column="0"
                                            Command="{Binding StartMonitoringCommand}"
                                            Content="{Binding ButtonText}"
                                            IsChecked="{Binding IsMonitoring}" />

                                        <telerik:RadGlyph
                                            Grid.Column="1"
                                            FontSize="16"
                                            Glyph="&#xe8b7;" />

                                        <TextBlock
                                            Grid.Column="2"
                                            Margin="5,0"
                                            VerticalAlignment="Center"
                                            FontSize="12"
                                            Text="{Binding FolderPath}" />

                                        <TextBlock
                                            Grid.Column="3"
                                            VerticalAlignment="Center"
                                            FontSize="12"
                                            Foreground="{Binding MonitoringStatusColor}"
                                            Text="{Binding MonitoringStatus}" />

                                        <telerik:RadButton Grid.Column="4" Command="{Binding DeleteFolderMonitoringCommand}">
                                            <telerik:RadGlyph FontSize="11" Glyph="&#xe10a;" />
                                        </telerik:RadButton>
                                    </Grid>
                                </DataTemplate>
                            </telerik:RadListBox.ItemTemplate>
                        </telerik:RadListBox>
                    </StackPanel>
                </telerik:RadTabItem>

                <!--  Agent Info Tab  -->
                <telerik:RadTabItem Header="Agent Info">
                    <StackPanel Margin="20">
                        <TextBlock
                            Margin="0,0,0,20"
                            FontSize="20"
                            Foreground="#ffffff"
                            Text="Agent Information" />

                        <!--  Client ID  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Client ID:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding ClientId}" />
                        </StackPanel>

                        <!--  Client Secret  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Client Secret:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding ClientSecret}" />
                        </StackPanel>

                        <!--  Client Secret  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Agent Group:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding AgentGroup}" />
                        </StackPanel>


                        <!--  Scan Configurations Title  -->
                        <TextBlock
                            Margin="0,20,0,10"
                            FontSize="18"
                            Foreground="#ffffff"
                            Text="Scan Configurations" />

                        <!--  Max Depth  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Max Depth:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding MaxDepth}" />
                        </StackPanel>

                        <!--  Files Per Folder  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Files Per Folder:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding MaxFilesPerFolder}" />
                        </StackPanel>

                        <!--  Files Per Scan  -->
                        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                            <TextBlock
                                Width="120"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Foreground="#A7A3DC"
                                Text="Files Per Scan:" />
                            <telerik:RadWatermarkTextBox
                                Width="250"
                                Background="#2E2F45"
                                BorderThickness="0"
                                IsReadOnly="True"
                                Text="{Binding TotalFilesPerScan}" />
                        </StackPanel>

                        <!--  Create Dump Button  -->
                        <telerik:RadButton Command="{Binding CreateDumpCommand}">
                            <StackPanel Orientation="Horizontal">
                                <telerik:RadGlyph FontSize="16" Glyph="&#xe105;" />
                                <TextBlock
                                    Margin="5,0,0,0"
                                    FontSize="18"
                                    Text=" Create Dump" />
                            </StackPanel>
                        </telerik:RadButton>
                    </StackPanel>
                </telerik:RadTabItem>
            </telerik:RadTabControl>
        </Border>
    </Grid>
</UserControl>
Stenly
Telerik team
 answered on 21 Feb 2025
1 answer
27 views
Hi team

I have this


    <Style x:Key="Style.RadTabItem.MainWindow" TargetType="{x:Type telerik:RadTabItem}">
        <!-- Base appearance -->
        <Setter Property="Background" Value="#01000000" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="16,0" />
        <Setter Property="Margin" Value="0,0,0,0" />
        <Setter Property="MinWidth" Value="160" />
        <Setter Property="MaxWidth" Value="240" />
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="telerikHelpers:ThemeHelper.MouseOverBrush" Value="{DynamicResource Tab.Background.MouseOver}" />
        <Setter Property="telerikHelpers:ThemeHelper.CheckedBrush" Value="{DynamicResource Tab.Background.Selected}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type telerik:RadTabItem}">
                    <Border x:Name="OuterBorder"
                            Background="Transparent"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid x:Name="grd_MainTabHeader">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Path x:Name="pth_Left"
                                  Fill="White"
                                  Data="M0,16 A16,16 0 0 0 16,0 L16,16 L0,16 Z"
                                  VerticalAlignment="Bottom"
                                  Visibility="Collapsed" />

                            <Border x:Name="MainBorder"
                                    Background="{TemplateBinding Background}"
                                    CornerRadius="8,8,0,0"
                                    Grid.Column="1"
                                    HorizontalAlignment="Stretch">
                                <Grid
                                    x:Name="grd_ContentSite"
                                    Margin="0">
                                    <Rectangle x:Name="FocusVisual" 
                                             Opacity="0"
                                             StrokeThickness="1"
                                             Stroke="Black"
                                             StrokeDashArray="1,1" />
                                    <ContentPresenter x:Name="ContentSite"
                                                    ContentSource="Header"
                                                    HorizontalAlignment="Stretch"
                                                    VerticalAlignment="Center"
                                                    Margin="{TemplateBinding Padding}" />
                                </Grid>
                            </Border>

                            <Path x:Name="pth_Right"
                                  Fill="White"
                                  Grid.Column="2"
                                  Data="M8,8 A8,8 0 0 1 0,0 L0,8 L8,8 Z"
                                  VerticalAlignment="Bottom"
                                  Visibility="Collapsed" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- Selected state -->
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="MainBorder" Property="Background" Value="White" />
                            <Setter TargetName="grd_MainTabHeader" Property="Margin" Value="-8,0,-8,0" />
                            <Setter TargetName="pth_Left" Property="Visibility" Value="Visible" />
                            <Setter TargetName="pth_Right" Property="Visibility" Value="Visible" />
                        </Trigger>

                        <!-- Mouse over state -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="MainBorder" Property="Background" Value="#e8eaed" />
                            <Setter TargetName="MainBorder" Property="CornerRadius" Value="16" />
                            <Setter TargetName="MainBorder" Property="Margin" Value="8, 0" />
                            <Setter TargetName="grd_ContentSite" Property="Margin" Value="-8, 0" />
                            
                        </MultiTrigger>

                        <!-- Focus state -->
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="FocusVisual" Property="Opacity" Value="1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

But it doesn't allow me to change selected items, as in I can't click on the tab to select it.

If I used this


<Style x:Key="Style.RadTabItem.MainWindow" TargetType="{x:Type telerik:RadTabItem}">

        <Setter Property="BorderBrush" Value="{DynamicResource Tab.Border.Selected}" />
        <Setter Property="BorderThickness" Value="0,2,0,0" />
        <Setter Property="Margin" Value="1,0" />
        <Setter Property="telerikHelpers:ThemeHelper.MouseOverBrush" Value="{DynamicResource Tab.Background.MouseOver}" />
        <Setter Property="telerikHelpers:ThemeHelper.CheckedBrush" Value="{DynamicResource Tab.Background.Selected}" />

        <Style.Triggers>
            <Trigger Property="IsSelected" Value="False">
                <Setter Property="BorderBrush" Value="Transparent" />
                <Setter Property="Background" Value="#E4E9FA" />
                <Setter Property="Margin" Value="1,0" />
            </Trigger>
        </Style.Triggers>
    </Style>

It works.

Can you help me identify what I could do to have it work?

Thanks,

H
Martin Ivanov
Telerik team
 answered on 13 Jan 2025
0 answers
68 views

Hello,

I'm trying to remove tab items from RadTabControl where ItemsSource is bound to an ObservableCollection<RadTabItem>. However, when an item is deleted from the collection the tab does not disappear. The desired behavior is for the tab to disappear. What do I need to do to achieve this?

Here's what I have:

xaml declaration:


 <telerik:RadTabControl x:Name="radTabControl"  
                     
                                ItemsSource="{ Binding Tabs }"
                                Padding="0, 0, 0, 0" 
                                Margin="0, 0, 0, 0" >

         </telerik:RadTabControl>

 

Here, I declare Tabs as an observable collection:

   public ObservableCollection<RadTabItem> Tabs { get; set; }

Here is where the tab items are deleted:


  private void RemoveTab(int dev)
        {
                Tabs.Clear();
 
        }

 

I'm not very familiar with WPF and Telerik in general. Any help would be appreciated.

Thanks.

Noah
Top achievements
Rank 1
 asked on 11 Jun 2024
1 answer
89 views

Hi,
We have an issue with tab control and the drop down menu items. Users can create multiple instances of the same tab, that's being displayed fine but when the drop down menu is shown, I can see the names of the tabs, i.e. multiple instances of say "Customer" tab. Now if I select first repeating tab then click on drop down, I can see multiple tabs being highlighted as selected. My question is how can I make those tab items unique so the tab control recognises them as such.

TIA

P.S. please find attached xaml for styling of drop down items
    <Style TargetType="Telerik_Windows_Controls_TabControl:DropDownMenu" x:Key="DropDownMenuStyle">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{StaticResource MainScreen.DropDownMenu.BorderBrush}"/>
        <Setter Property="Background" Value="{StaticResource {x:Static root:TabResources.Tab_Active_Background_Brush}}"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="IconColumnWidth" Value="0"/>
        <Setter Property="MaxHeight" Value="500"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <telerik:RadWrapPanel Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="Telerik_Windows_Controls_TabControl:DropDownMenuItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Telerik_Windows_Controls_TabControl:DropDownMenuItem">
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsChecked" Value="True">
                                        <Setter Property="TextBlock.FontWeight" Value="Bold"/>
                                        <Setter Property="Border.Visibility" Value="Visible"/>
                                    </Trigger>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="TextBlock.FontWeight" Value="SemiBold"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                                <Grid MaxWidth="250" MaxHeight="100"
                                      ScrollViewer.VerticalScrollBarVisibility="Disabled" 
                                      DataContext="{Binding ., Converter={StaticResource String2ComplexObjectConverter}}" 
                                      ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="2"/><!--padding left-->
                                        <ColumnDefinition Width="3"/><!--selected item border-->
                                        <ColumnDefinition/><!--content-->
                                        <ColumnDefinition Width="5"/><!--padding right-->
                                    </Grid.ColumnDefinitions>
                                    <!--Let's try to put something that can be hit detected when mousing over-->
                                    <TextBlock Text="" Grid.ColumnSpan="4" HorizontalAlignment="Stretch"/>
                                    <Border Background="{StaticResource ResourceKey={x:Static root:TabResources.Tab_Selected_Indicator_Brush}}"
                                            Visibility="{Binding RelativeSource={RelativeSource AncestorType=Telerik_Windows_Controls_TabControl:DropDownMenuItem}, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}" 
                                            Grid.Column="1"/>
                                    <TextBlock Text="{Binding Title}"
                                               Foreground="{StaticResource {x:Static ColourResources.MenubarRibbonText}}"
                                               Margin="3,0"
                                               FontFamily="Segoe UI"
                                               Grid.Column="2"/>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Telerik_Windows_Controls_TabControl:DropDownMenu">
                    <Border Background="{TemplateBinding Background}"
                            Margin="{TemplateBinding Padding}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ItemsPresenter Margin="2,5,3,10" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Dinko
Telerik team
 answered on 08 Nov 2023
0 answers
60 views

Hello dear Telerik Forum.

I have a memory leak problem, where opening views add up in memory, because they are still somehow referenced and thus not GCed.

I've implemented Prism and Telerik both in my application. I've also implemented the ScopedRegionNavigationContentLoader,  the RegionManagerAwareBehavior (and everything else required to open views in new tabs) from Brian (Prism) and the RadTabbedWindow in my MainWindow. So when I execute RequestNavigate from the MainWindow I open new Tabs.

Following happens:

When I execute RequestNavigate commands from the MainWindow I successfully open a new tab which then builds the view, existing of multiple subviews. This works correct so far.

Now when I close the RadTabItems the Views still stay in the memory. It seems there are still references in the RegionManager about the once spawned Regions/Views. Those add up when using the application over hours.

 

So my question is:

How do I unload the Region/View in the RegionManager of the MainWindow when I close the tabs?

I'm looking for a clean and global solution, where I dont have to implement code in every class.

 

 

Extra information:

- There is one RegionManager in the MainWindow, which manages all Tabs and so.

- Each Subview gets its own new RegionManager instance.

 

Anastasios
Top achievements
Rank 1
 updated question on 26 Oct 2023
1 answer
85 views

 radTabControl.SelectedItem = radTabItem;     // set tab as the active one
 radTabItem.Content = userControl;  

The code above runs but the contents of the previous RadTabItem remain on srceen.

The tab and visual indicator showing what tab the user is on show but all the contents are those that belong to the previous tab.
Is there a refresh command that I'm missing?

 

Dinko
Telerik team
 answered on 08 Sep 2023
0 answers
114 views

I have the following

For some reason the binding to MyCommand not triggering at all at my view model
Im using MvvmLight RelayCommand if it matters everywhere in my app

P.s 
I tried to change Button to RadButton and the result are the same

<UserControl>
   <Grid>
       <telerik:RadTabControl>
         <telerik:RadTabControl.AdditionalContent>
              <StackPanel Orientation="horizontal"
                                    DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AnsectorType={x:Type UserControl}}, Path=DataContext}">
                      <Button Command="{Binding Path=MyCommand}">
                      </Button>
              </StackPanel>
        </telerik:RadTabControl.AdditionalContent>
       <telerik:RadTabControl.Items>
             <telerik:RadItem>
                  <!-- Here everything works just fine -->
              </telerik:RadItem>
       </telerik:RadTabControl.Items>
    </telerik:RadTabControl>
   </Grid>
</UserControl>


ofir
Top achievements
Rank 1
 asked on 15 Mar 2023
1 answer
94 views

I am using RadTabItem s. One of them has a RadGridView. EnableRowVirtualization on the grid is set to true as it is by default.

When you change to another tab then change back to the tab with this grid, it is very slow. I am testing with about 2,000 rows. I set EnableRowVirtualization to false and loading and clearing the grid is a little slower, but it's quicker to switch back into the tab with the grid.

It seems to me that switching in and out of this tab when row virtualization is enabled, the grid is disposing and reloading the rows. Loading and clearing the grid with virtualization enabled is faster, but changing tabs is significantly slower than when it's disabled.

I have looked through all the attributes of RadGridView and tried setting a few of them with no luck.

I am trying to figure out if there is some setting/attribute for the RadGridView or RadTabItem I can configure to have tabbing as quick and it is when row virtualization is disabled.

Martin Ivanov
Telerik team
 answered on 16 Nov 2022
1 answer
115 views

Hi team,

How can I  change the background of the  tabcontrol header?

And also  I want to set corners  of  header area like image 2.

I have setted  corners  of   content area ,but there is  a outline, look at image 3

 

Thanks in Advance.

 

Vicky
Telerik team
 answered on 24 Aug 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?