enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.19k stars 143 forks source link

Version - 2.10.0- Can not apply Icon property to DatePickerField in global styles. #780

Closed ketakidevendra closed 2 months ago

ketakidevendra commented 2 months ago

I have applied image to Icon property in Styles.xaml globally like below:

After upgrading to 2.10.0 it throws Null reference exception for IconDate. Same is applied at page level or directly in control correctly. This was working in earlier version so order in Mergedictionaries should be correct in App.xaml.

Same is applicable to TimePickerField.

Suggestion - It would be great if these controls are having an icon by default.

StepKie commented 2 months ago

Hi @enisn, this seems on first glance very similar to other global styling issues like https://github.com/enisn/UraniumUI/issues/663. Is there a chance these are related in any way? Anything we could do to help?

enisn commented 2 months ago

I think it's related to https://github.com/enisn/UraniumUI/pull/728

InputField started to use ControlTemplate instead of initializing everything in the constructor for better performance & memory optimizations. But after that change, iconContainer isn't initialized when the style is applied to the control.

I can use a proxy binding between Icon property of InputField to Source property of Image. or I can continue to set directly from C#.

Using direct setter is much more faster and performant but it doesn't respond style or theme changes. I'll make a development on this soon 👍

enisn commented 2 months ago

I just fixed crash for now with PR $783

I'll enhance it later