Baseflow / Baseflow/XF-Material-Library

MaterialTextField opacity set to 0.3 when IsEnabled = false

Open
#254 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
633
Forks
150
PR merge metrics
No merged PRs in 30d

Description

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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.