Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to customize the SelectionView #94

Open
ronakshethia opened this issue Mar 14, 2019 · 8 comments
Open

Not able to customize the SelectionView #94

ronakshethia opened this issue Mar 14, 2019 · 8 comments
Labels
enhancement New feature or request feature A new feature question Further information is requested

Comments

@ronakshethia
Copy link

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

@enisn
Copy link
Owner

enisn commented Mar 14, 2019

@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());
        }

@enisn
Copy link
Owner

enisn commented Mar 14, 2019

I'm labeling this issue as Enchantment and customizing feature will be added to selectionview

@enisn enisn added enhancement New feature or request question Further information is requested labels Mar 14, 2019
@ronakshethia
Copy link
Author

Thanks it worked for me :)

@Klewerro
Copy link

@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.

@HelenMamalaki
Copy link

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.

@DevonHansen
Copy link

I'm in the same boat as @HelenMamalaki on this. Any work around?

@aismaniotto
Copy link

Me too

@enisn enisn pinned this issue Nov 25, 2020
@enisn enisn added the feature A new feature label Nov 25, 2020
@enisn
Copy link
Owner

enisn commented Apr 7, 2021

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;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature A new feature question Further information is requested
Projects
Feature Development
  
Awaiting triage
Development

No branches or pull requests

6 participants