Xamarin.Forms.InputKit
Xamarin.Forms.InputKit copied to clipboard
Not able to customize the SelectionView
i am not able to change the color of radio circle and also not able to resize the font of the radio button could u please provide that functionality
@ronakshethia Of course. That is right.
SelectionView is not a real control. just generates RadioButtons, CheckBoxes or buttons at runtime. It uses Control's default settings.
If your SelectionType is CheckBox you can try change GlobalSetting
of CheckBox.
-- For example.
if you have that:
<input:SelectionView ItemsSource="{Binding SampleList}" SelectionType="CheckBox" />
go to your App.cs
public App()
{
InitializeComponent();
//also this will changes default values of all checkboxes in your app
Plugin.InputKit.Shared.Controls.CheckBox.GlobalSetting.BorderColor = Color.Blue;
MainPage = new NavigationPage(new Sample.InputKit.MainPage());
}
If you havethat:
<input:SelectionView ItemsSource="{Binding SampleList}" SelectionType="RadioButton" />
go to your App.cs
public App()
{
InitializeComponent();
//also this will changes default values of all radiobuttons in your app
Plugin.InputKit.Shared.Controls.RadioButton.GlobalSetting.BorderColor = Color.Blue;
MainPage = new NavigationPage(new Sample.InputKit.MainPage());
}
I'm labeling this issue as Enchantment and customizing feature will be added to selectionview
Thanks it worked for me :)
@enisn Your solution form above is working, but when I select any RadioButton from SelectionView - style of selected button is going back to default "pink-gray". I have tested it in SelectionView and RadioButtonGroupView with radio buttons, with the same results in both.
I couldn't get the GlobalSetting to work for me, I need to set it in a Theme Detection class to set colors for Dark mode vs light mode.
I'm in the same boat as @HelenMamalaki on this. Any work around?
Me too
Also, overriding SelectionView is a workaround for now:
using Plugin.InputKit.Shared.Abstraction;
using Plugin.InputKit.Shared.Controls;
namespace App3
{
public class MySelectionView : SelectionView
{
public override ISelection GetInstance(object obj)
{
var instance = base.GetInstance(obj);
if (instance is Plugin.InputKit.Shared.Controls.CheckBox checkBox)
{
checkBox.BoxSizeRequest = 18;
checkBox.TextFontSize = 22;
checkBox.SetDynamicResource(Plugin.InputKit.Shared.Controls.CheckBox.IconColorProperty, "SecondaryColor");
}
return instance;
}
}
}