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

Change CustomDoneButtonTitle at live time #93

Open
tschennie opened this issue Feb 21, 2024 · 1 comment
Open

Change CustomDoneButtonTitle at live time #93

tschennie opened this issue Feb 21, 2024 · 1 comment

Comments

@tschennie
Copy link

tschennie commented Feb 21, 2024

Version: 2.5.1
Xamarin.Forms Version: 5.0.0.2012

Can I change the CustomDoneButtonTitle depending on whether I have selected an image or not? With AutoDisableDoneButton, I can only set the button to be disabled, but it will still be displayed..

I tried:

m_CurrentPicker = new GMImagePickerController(...);

m_CurrentPicker.AssetSelected += CurrentPickerOnAssetSelected;
m_CurrentPicker.AssetDeselected += CurrentPickerOnAssetSelected;

    private void CurrentPickerOnAssetSelected(object sender, SingleAssetEventArgs args)
    {
        var selectedCount = m_CurrentPicker.SelectedAssets.Count;
        m_CurrentPicker.CustomDoneButtonTitle = selectedCount > 0 ? "Done" : "";
    }
@roycornelissen
Copy link
Owner

Hi! Setting the CustomDoneButtonTitle does not update the button at real time, it only initializes the buttons once during ViewDidLoad. So that CustomDoneButtonTitle is not data bound to the actual button anymore. It's probably doable by wiring some stuff up in the property setter but it's quite a refactor to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants