Telerik Forums
UI for Xamarin Forum
0 answers
72 views

I using Light and Dark themes in my app.

In each theme I set Styles for BorderStyle and RadEntry.

<telerikInput:BorderStyle x:Key="EntryBorderStyle"
                          CornerRadius="5"
                          BorderColor="{DynamicResource PrimaryColor}"
                          BorderThickness="1"/>

<Style TargetType="{x:Type telerikInput:RadEntry}">
    <Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}" />
    <Setter Property="TextColor" Value="{DynamicResource TextThemeColor}" />
    <Setter Property="BorderStyle" Value="{DynamicResource EntryBorderStyle}" />
    <Style.Triggers>
        <Trigger TargetType="telerikInput:RadEntry" Property="IsEnabled" Value="False">
            <Setter Property = "TextColor" Value="{DynamicResource DisabledTextColor}"/>
        </Trigger>
    </Style.Triggers>
</Style>

but when I use RadEntry on ContentPage, styles are not attached properly, BorderColor not work after app start.

The only way to properly working Style is to add styles to ContentPage.Resources, remove entry and add again and HotReload page.

I also check solution with adding StaticResource in App.xaml:

<Application.Resources>
    <ResourceDictionary>
        <telerikInput:BorderStyle x:Key="EntryBorderStyle"
                                CornerRadius="5"
                                BorderColor="{DynamicResource PrimaryColor}"
                                BorderThickness="1"/>

        <telerikInput:BorderStyle x:Key="EntryErrorBorderStyle"
                                CornerRadius="5"
                                BorderColor="{DynamicResource ErrorColor}"
                                BorderThickness="1" />

        <Style TargetType="telerikInput:RadEntry">
            <Setter Property="BorderStyle" Value="{StaticResource EntryBorderStyle}" />
            <Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}" />
            <Setter Property="TextColor" Value="{DynamicResource TextThemeColor}" />
            <Style.Triggers>
                <Trigger TargetType="telerikInput:RadEntry" Property="IsEnabled" Value="False">
                    <Setter Property = "TextColor" Value="{DynamicResource DisabledTextColor}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
and it alos doesn't work.

 

n/a
Top achievements
Rank 1
Iron
 updated question on 21 Sep 2023
1 answer
51 views

I using styling validation on form by DataTrigger.
When Validator.IsValid == false then DataTrigger changes specified feature.

In case of standard RadEntry control, I could specify BorderColor.

But how to work with RadNumericinput when such control not exposes any input element property?

<telerikInput:RadNumericInput x:Name="numericInput" 
                                          IsEnabled="{Binding IsEnabled}"
                                          Value="{Binding Value,Mode=TwoWay}"
                                          VerticalOptions="Center" 
                                          HorizontalOptions="FillAndExpand">
                <telerikInput:RadNumericInput.Triggers>
                    <DataTrigger TargetType="telerikInput:RadNumericInput"
                                 Binding="{Binding Validator.IsValid}"
                                 Value="False">
                        <Setter Property="BorderStyle">
                            <telerikInput:BorderStyle BorderColor="{DynamicResource ErrorColor}" />
                        </Setter>
                    </DataTrigger>
                </telerikInput:RadNumericInput.Triggers>
            </telerikInput:RadNumericInput>


Didi
Telerik team
 updated answer on 28 Dec 2022
1 answer
117 views

I using LightTheme and DarkTheme in app.
But I have a problem with +/- buttons CornerRadius and Entry border styling.
They are not react to specified style.

How to style buttons and entry to custom apperance without override whole control template?

Documentation is too poor in this context.

Here is my xaml:

<telerikInput:RadNumericInput x:Name="numericInput" 
                              IsEnabled="{Binding IsEnabled}"
                              Value="{Binding Value,Mode=TwoWay}"
                              VerticalOptions="Center" 
                              HorizontalOptions="FillAndExpand">
            </telerikInput:RadNumericInput>

And syles:

<Style TargetType="{x:Type telerikInput:RadNumericInput}">
        <Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}" />
    </Style>

    <Style TargetType="{x:Type telerikNumericInput:NumericInputButton}">
        <Setter Property="BorderRadius" Value="5" />
        <Setter Property="BorderColor" Value="{DynamicResource PrimaryColor}"/>
        <Setter Property="TextColor" Value="{DynamicResource TextThemeColor}"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
    </Style>
    
    <Style TargetType="{x:Type telerikNumericInput:NumericInputEntry}">
        <Setter Property="TextColor" Value="{DynamicResource TextThemeColor}"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="Keyboard" Value="Numeric"/>
        <Setter Property="BorderStyle">
            <Setter.Value>
                <telerikInput:BorderStyle>
                    <telerikInput:BorderStyle.BorderThickness>
                        <OnPlatform x:TypeArguments="Thickness" Default="1">
                            <On Platform="Android" Value="1"/>
                            <On Platform="iOS" Value="1"/>
                            <On Platform="UWP" Value="1"/>
                        </OnPlatform>
                    </telerikInput:BorderStyle.BorderThickness>
                </telerikInput:BorderStyle>
            </Setter.Value>
        </Setter>
    </Style>


 

Didi
Telerik team
 answered on 28 Dec 2022
1 answer
88 views

I am working on Xamarin UWP project and have used the following code mentioned below for calendar cell styling. I am not able to change text color of specific dates in other month, it always display other month dates as gray,  can you please provide me a solution.


private CalendarCellStyle EvaluateCellStyle(CalendarCell cell)
{
    Color background = default(Color);
    Color selectedCellForegroundColor = default(Color);
    Color todayBorderColor = Color.FromRgb(115, 174, 239);
    double dayNamesFontSize = default(double);
    double fontSize = default(double);
    Thickness todayBorderThickness = default(Thickness);

    switch (Device.RuntimePlatform)
    {
        case "iOS":
            background = Color.White;
            selectedCellForegroundColor = Color.White;
            fontSize = 14;
            dayNamesFontSize = 14;
            todayBorderThickness = new Thickness(2);
            break;
        case "Android":
            background = Color.White;
            selectedCellForegroundColor = Color.FromHex("FF0066CC");
            fontSize = 15;
            dayNamesFontSize = 15;
            todayBorderThickness = new Thickness(1);
            break;
        case "UWP":
            background = Color.FromRgb(30, 30, 30);
            selectedCellForegroundColor = Color.White;
            fontSize = 17;
            dayNamesFontSize = 17;
            todayBorderThickness = new Thickness(2);
            break;
    }

    if (cell.Type == CalendarCellType.DayName)
    {
        return new CalendarCellStyle
        {
            BackgroundColor = Color.LightGray,
            FontSize = dayNamesFontSize,
            FontAttributes = FontAttributes.Bold,
            TextColor = Color.FromRgb(0, 122, 255)
        };
    }

    var defaultStyle = new CalendarCellStyle
    {
        BackgroundColor = background,
        FontSize = fontSize,
        FontAttributes = FontAttributes.None,
        TextColor = Color.FromRgb(139, 209, 0)
    };

    if (cell is CalendarDayCell dayCell)
    {
        if (dayCell.IsFromCurrentMonth)
        {
            if (dayCell.IsToday)
            {
                defaultStyle.TextColor = Color.FromRgb(0, 122, 255);
                defaultStyle.FontAttributes = FontAttributes.Bold;
                defaultStyle.BorderColor = todayBorderColor;
                defaultStyle.BorderThickness = todayBorderThickness;
            }
        }
        else
        {
            if (dayCell.IsToday)
            {
                defaultStyle.TextColor = todayBorderColor;
                defaultStyle.BorderColor = todayBorderColor;
                defaultStyle.BorderThickness = todayBorderThickness;
            }
            else
            {
                
                  if (dayCell.Date.DayOfWeek == DayOfWeek.Sunday || dayCell.Date.DayOfWeek == DayOfWeek.Saturday)
                  {
                           defaultStyle.TextColor = Color.Red;
                  }
                  else
                  {
                           defaultStyle.TextColor = Color.Gray;
                  }

            }
        }

        if (dayCell.IsSelected)
        {
            defaultStyle.TextColor = selectedCellForegroundColor;
            defaultStyle.BorderColor = Color.FromHex("FF0066CC");
        }

        return defaultStyle;
    }

    return null; // default style
}

Didi
Telerik team
 answered on 31 Oct 2022
0 answers
242 views

Hi,

I have this error in release mode only in android ,

Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Telerik.XamarinForms.Common.Painters.PurePainter' (defined in assembly 'Telerik.XamarinForms.SkiaSharp, Version=2020.3.1207.460, Culture=neutral, PublicKeyToken=null') with scope 'Telerik.XamarinForms.Common, Version=2020.3.1207.460, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Telerik.XamarinForms.Common.Painters.PurePainter
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field)
   at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
   at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17

0 answers
74 views

I use RadTreeView when i change flow direction To Right to left in Arabic language the treeView Display in one level 

like in attached image .

Any help ?

 

Menna
Top achievements
Rank 1
 updated question on 08 Dec 2021
1 answer
250 views

How to common the grid header styles (Dark & light), by repeating each column header for light & dark theme it'll increase the number of code, need to common all headers styles.

please give me a solution...

Thanks...

<telerikDataGrid:DataGridTextColumn.HeaderStyle>
    <AppThemeBinding>
        <AppThemeBinding.Light>
            <telerikDataGrid:DataGridColumnHeaderStyle 
                    BackgroundColor="#ffffff"
                    BorderColor="#F0EFF3"
                    BorderThickness="1"/>
        </AppThemeBinding.Light>
        <AppThemeBinding.Dark>
            <telerikDataGrid:DataGridColumnHeaderStyle 
                    BackgroundColor="#2a3137"
                    BorderColor="#505d68"
                    BorderThickness="1"/>
        </AppThemeBinding.Dark>
    </AppThemeBinding>
</telerikDataGrid:DataGridTextColumn.HeaderStyle>

 

Didi
Telerik team
 answered on 22 Sep 2021
1 answer
129 views

Hi, I'm trying to apply theme changes to telerikInput:RadDateTimePicker, place holder & text colour change from ThemeDark.xaml & ThemeLight.xaml

by using

DisplayLabelStyle="{AppThemeBinding Dark={StaticResource TextColorDark},
                                                            Light={StaticResource PrimaryTextColorLight}}"   

and

PlaceholderLabelStyle="{AppThemeBinding Dark={StaticResource TextColorDark},
                                                            Light={StaticResource PrimaryTextColorLight}}"            
                                    SelectionHighlightStyle="{StaticResource selectionHighlightStyle}"

 

but this AppThemeBinding doesn't work, If there is any working solution, please share with me.

Thanks

1 answer
512 views

I just used the approach outlined in the link below to set a custom color for the selected row in my RadGridView control.

WPF DataGrid | SelectedBackground and MouseOverBackground | Telerik UI for WPF

This approach seems to have worked just fine for the case when the user clicks on a row to select it.  However, when the SelectedItem property of the grid view is set in code through data binding, the selected row color reverts to the default value.  Only upon clicking the row again does it display using the color that I defined.

Am I missing something?

Thanks!

Stenly
Telerik team
 answered on 13 Jul 2021
0 answers
72 views
Show the comparison before and after switching the theme in the attachment
guo
Top achievements
Rank 1
Iron
 asked on 16 Jun 2021
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?