XF-Material-Library icon indicating copy to clipboard operation
XF-Material-Library copied to clipboard

MaterialTextField opacity set to 0.3 when IsEnabled = false

Open rjovic opened this issue 4 years ago • 1 comments

Not a real issue, but more "design" question.

We are using MaterialTextField for showing data to the user but when user is not in edit mode then we show all text fields as disabled.

When looking at following code in MaterialTextField.xaml.cs:

private void OnEnabledChanged(bool isEnabled) { Opacity = isEnabled ? 1 : 0.33; helper.IsVisible = isEnabled && !string.IsNullOrEmpty(HelperText); }

it seems that opacity 0.33 is always forced when text-field is not enabled which is opposite of what we want to achieve. On our Android app built with Kotlin and Material design when material text field is disabled opacity is not changed.

I tried to "override" it with the style trigger but it seems that this will not work because above function is always firing after the triggers.

<Style x:Key="materialTextField" TargetType="material:MaterialTextField"> <Style.Triggers> <Trigger TargetType="material:MaterialTextField" Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value="1" /> </Trigger> <Trigger TargetType="material:MaterialTextField" Property="IsEnabled" Value="True"> <Setter Property="Opacity" Value="1" /> </Trigger> </Style.Triggers> </Style>

Is this Opacity thing by design or you are accepting PR's which will put this opacity as optional bindable property where if not defined it can remain the same as today but if user choose to not apply Opacity on disabled field it can configure that via available property.

Let me know, I'm willing to work on PR's if this is something that is acceptable.

Regards, Renato

rjovic avatar Dec 10 '19 15:12 rjovic

Yes PR's are always welcome!

OdetteP avatar Dec 11 '19 06:12 OdetteP