Hello i'm using the Handycontrol framework and it seems my code is somehow cursed and doesn't want to change the text foreground color of a selected row in the DataGrid.
Here is the code of my App.xaml:
<Application x:Class="GymAppDev01.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:GymAppDev01">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
<hc:Theme Skin="Dark" AccentColor="#FFD6FD51" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
and here is the code of my EmployeeGrid.xaml: Note that the background & font weight are being changed correctly when the "IsSelected" property is trigerred. And the font is set correctly to "Gray" by default , but when I change the foreground of the text in the "IsSelected" trigger (which is what i want), the program somehow fears breaking the laws of the universe and creating a space-time hole if he performs this action and refuses to change the color. This error is driving me crazy so can someone please break this curse and help me make it work.
<UserControl
x:Class="GymAppDev01.UGUI.Components.EmployeeGrid"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:entity="clr-namespace:GymAppDev01.src.Entity"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
d:DesignHeight="700"
d:DesignWidth="1000"
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="CustomDataGridRowStyle" TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="Foreground" Value="Gray"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Blue"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="CustomDataGridBaseStyle" TargetType="DataGrid" BasedOn="{StaticResource DataGridBaseStyle}">
<Setter Property="RowStyle" Value="{StaticResource CustomDataGridRowStyle}" />
</Style>
</UserControl.Resources>
<Grid Grid.Column="1" Margin="32">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<hc:Pagination x:Name="PaginationBar" FontFamily="IBM Plex Sans Arabic Medium" FontWeight="Bold"
IsJumpEnabled="{Binding IncludeJump}" MaxPageCount="{Binding PageNumber}"
PageIndex="{Binding PageIndex}" HorizontalAlignment="Left" VerticalAlignment="Center">
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="PageUpdated">
<hc:EventToCommand Command="{Binding PageUpdatedCmd}" PassEventArgsToCommand="True" />
</hc:EventTrigger>
</hc:Interaction.Triggers>
</hc:Pagination>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
<hc:SearchBar x:Name="SearchBar" hc:InfoElement.Placeholder="Search" hc:InfoElement.Necessary="True"
Style="{StaticResource SearchBarExtend}" Width="190" Margin="0,0,10,0"
FontFamily="IBM Plex Sans Arabic" />
<Button hc:IconElement.Geometry="{StaticResource AddGeometry}" x:Name="Button_AddEmployee" Content="Add"
Background="#FFD6FD51" BorderBrush="{x:Null}" FontFamily="IBM Plex Sans Arabic"
Foreground="#FF1C1C1E" Margin="0,0,10,0" Click="Button_AddEmployee_Click" FontWeight="Bold" />
<Button x:Name="Button_RevertContext" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"
hc:IconElement.Height="15" BorderBrush="{x:Null}" FontFamily="IBM Plex Sans Arabic"
FontWeight="Bold" Foreground="#FF1C1C1E" Margin="0,0,10,0" Click="Button_RevertContext_Click">
<Button.Background>
<SolidColorBrush Color="{DynamicResource DarkInfoColor}" />
</Button.Background>
</Button>
<Button x:Name="Button_DeleteEmployee" hc:IconElement.Geometry="{StaticResource RemoveGeometry}"
BorderBrush="{x:Null}" FontFamily="IBM Plex Sans Arabic" FontWeight="Bold" Foreground="#FF1C1C1E"
Margin="0,0,10,0" Height="30" Width="40" Click="Button_DeleteEmployee_Click">
<Button.Background>
<SolidColorBrush Color="{DynamicResource AccentColor}" />
</Button.Background>
</Button>
<Button x:Name="Button_Save" hc:IconElement.Geometry="{StaticResource SaveGeometry}" BorderBrush="{x:Null}"
FontFamily="IBM Plex Sans Arabic" FontWeight="Bold" Foreground="#FF1C1C1E" Height="30" Width="40"
Click="Button_Save_Click">
<Button.Background>
<SolidColorBrush Color="{DynamicResource SuccessColor}" />
</Button.Background>
</Button>
</StackPanel>
<hc:TransitioningContentControl Grid.Row="1" TransitionMode="Bottom2TopWithFade">
<DataGrid Style="{StaticResource CustomDataGridBaseStyle}" AutoGenerateColumns="False"
x:Name="EmployeeDataGrid" Grid.Row="1" Margin="0,15,0,0"
HeadersVisibility="All" ItemsSource="{Binding DataEmployees}" RowHeaderWidth="60"
hc:DataGridAttach.CanUnselectAllWithBlankArea="True" FontFamily="Plus Jakarta Sans"
Foreground="{x:Null}" Background="#FF2D2D30">
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<CheckBox
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=DataGridRow}}" />
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns>
<DataGridTextColumn Width="80" Binding="{Binding IdEmployee}" CanUserResize="False" Header="Index"
IsReadOnly="True" />
<DataGridTemplateColumn Width="60" CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Ellipse Width="32" Height="32" ClipToBounds="True" StrokeThickness="13"
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0">
<Ellipse.Fill>
<ImageBrush ImageSource="{Binding PicturePath}" Stretch="UniformToFill"
RenderOptions.BitmapScalingMode="NearestNeighbor" TileMode="None" />
</Ellipse.Fill>
</Ellipse>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding FirstName}" Header="First Name" MinWidth="60" />
<DataGridTextColumn Binding="{Binding LastName}" Header="Last Name" />
<DataGridTextColumn Binding="{Binding Username}" Header="Username" />
<DataGridTextColumn Binding="{Binding Password}" Header="Password" />
<DataGridTextColumn Binding="{Binding DateOfBirth}" Header="Date of Birth" />
<DataGridTextColumn Binding="{Binding Gender}" Header="Gender" />
<DataGridTextColumn Binding="{Binding ContactNumber}" Header="Contact Number" />
</DataGrid.Columns>
</DataGrid>
</hc:TransitioningContentControl>
</Grid>
</UserControl>