Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 0b73f6f

Browse files
Change default value of focused properties (#29)
* focused * border, back * Restore properties to the styles Co-authored-by: Agustin Bonilla <agustin.bonilla@horus.com.uy>
1 parent 44a872c commit 0b73f6f

10 files changed

Lines changed: 150 additions & 86 deletions

example/ExampleMaterialDesignControls.iOS/ExampleMaterialDesignControls.iOS.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
<ProjectReference Include="..\..\src\MaterialDesignControls.iOS\MaterialDesignControls.iOS.csproj">
173173
<Project>{2BFC48FE-5BE1-4482-8469-77DDA82D13C8}</Project>
174174
<Name>MaterialDesignControls.iOS</Name>
175+
<IsAppExtension>false</IsAppExtension>
176+
<IsWatchApp>false</IsWatchApp>
175177
</ProjectReference>
176178
</ItemGroup>
177179
<ItemGroup>

example/ExampleMaterialDesignControls.sln

Lines changed: 131 additions & 69 deletions
Large diffs are not rendered by default.

src/MaterialDesignControls/Controls/BaseMaterialFieldControl.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Color TextColor
7777
}
7878

7979
public static readonly BindableProperty FocusedTextColorProperty =
80-
BindableProperty.Create(nameof(FocusedTextColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.Gray);
80+
BindableProperty.Create(nameof(FocusedTextColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.Transparent);
8181

8282
public Color FocusedTextColor
8383
{
@@ -157,7 +157,7 @@ public Color LabelTextColor
157157
}
158158

159159
public static readonly BindableProperty FocusedLabelTextColorProperty =
160-
BindableProperty.Create(nameof(FocusedLabelTextColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.Gray);
160+
BindableProperty.Create(nameof(FocusedLabelTextColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.Transparent);
161161

162162
public Color FocusedLabelTextColor
163163
{
@@ -228,7 +228,7 @@ public Color BorderColor
228228
}
229229

230230
public static readonly BindableProperty FocusedBorderColorProperty =
231-
BindableProperty.Create(nameof(FocusedBorderColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.LightGray);
231+
BindableProperty.Create(nameof(FocusedBorderColor), typeof(Color), typeof(BaseMaterialFieldControl), defaultValue: Color.Transparent);
232232

233233
public Color FocusedBorderColor
234234
{
@@ -387,7 +387,7 @@ private static bool OnAssistiveTextValidate(BindableObject bindable, object valu
387387
protected void SetLabelTextColor(Label lblLabel)
388388
{
389389
if (IsControlEnabled)
390-
lblLabel.TextColor = IsControlFocused ? FocusedLabelTextColor : LabelTextColor;
390+
lblLabel.TextColor = IsControlFocused && FocusedLabelTextColor != Color.Transparent ? FocusedLabelTextColor : LabelTextColor;
391391
else
392392
lblLabel.TextColor = DisabledLabelTextColor;
393393
}
@@ -399,12 +399,12 @@ private void SetBorderAndBackgroundColors(Frame frmContainer, BoxView bxvLine)
399399
case FieldTypes.Outlined:
400400
case FieldTypes.Filled:
401401
if (IsControlEnabled)
402-
frmContainer.BackgroundColor = IsControlFocused ? FocusedBackgroundColor : BackgroundColorControl;
402+
frmContainer.BackgroundColor = IsControlFocused && FocusedBackgroundColor != Color.Transparent ? FocusedBackgroundColor : BackgroundColorControl;
403403
else
404404
frmContainer.BackgroundColor = DisabledBackgroundColor;
405405

406406
if (IsControlEnabled)
407-
frmContainer.BorderColor = IsControlFocused ? FocusedBorderColor : BorderColor;
407+
frmContainer.BorderColor = IsControlFocused && FocusedBorderColor != Color.Transparent ? FocusedBorderColor : BorderColor;
408408
else
409409
frmContainer.BorderColor = DisabledBorderColor;
410410

@@ -416,7 +416,7 @@ private void SetBorderAndBackgroundColors(Frame frmContainer, BoxView bxvLine)
416416
bxvLine.IsVisible = true;
417417

418418
if (IsControlEnabled)
419-
bxvLine.Color = IsControlFocused ? FocusedBorderColor : BorderColor;
419+
bxvLine.Color = IsControlFocused && FocusedBorderColor != Color.Transparent ? FocusedBorderColor : BorderColor;
420420
else
421421
bxvLine.Color = DisabledBorderColor;
422422
break;

src/MaterialDesignControls/Controls/MaterialCodeEntry.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ protected override void SetTextColor()
393393
foreach (var lblCode in lblCodes)
394394
{
395395
if (IsControlEnabled)
396-
lblCode.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
396+
lblCode.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
397397
else
398398
lblCode.TextColor = DisabledTextColor;
399399
}
@@ -444,12 +444,12 @@ private void SetTypeBackgroundAndBorderColor()
444444
foreach (var frmContainer in frmContainers)
445445
{
446446
if (IsControlEnabled)
447-
frmContainer.BackgroundColor = IsControlFocused ? FocusedBackgroundColor : BackgroundColorControl;
447+
frmContainer.BackgroundColor = IsControlFocused && FocusedBackgroundColor != Color.Transparent ? FocusedBackgroundColor : BackgroundColorControl;
448448
else
449449
frmContainer.BackgroundColor = DisabledBackgroundColor;
450450

451451
if (IsControlEnabled)
452-
frmContainer.BorderColor = IsControlFocused ? FocusedBorderColor : BorderColor;
452+
frmContainer.BorderColor = IsControlFocused && FocusedBorderColor != Color.Transparent ? FocusedBorderColor : BorderColor;
453453
else
454454
frmContainer.BorderColor = DisabledBorderColor;
455455
}
@@ -469,7 +469,7 @@ private void SetTypeBackgroundAndBorderColor()
469469
bxvLine.IsVisible = true;
470470

471471
if (IsControlEnabled)
472-
bxvLine.Color = IsControlFocused ? FocusedBorderColor : BorderColor;
472+
bxvLine.Color = IsControlFocused && FocusedBorderColor != Color.Transparent ? FocusedBorderColor : BorderColor;
473473
else
474474
bxvLine.Color = DisabledBorderColor;
475475

src/MaterialDesignControls/Controls/MaterialDatePicker.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ protected override void SetPadding()
177177
protected override void SetTextColor()
178178
{
179179
if (IsControlEnabled)
180-
pckDate.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
180+
pckDate.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
181181
else
182182
pckDate.TextColor = DisabledTextColor;
183183
}

src/MaterialDesignControls/Controls/MaterialDoublePicker.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ protected override void SetPadding()
304304
protected override void SetTextColor()
305305
{
306306
if (IsControlEnabled)
307-
pckOptions.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
307+
pckOptions.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
308308
else
309309
pckOptions.TextColor = DisabledTextColor;
310310
}

src/MaterialDesignControls/Controls/MaterialEditor.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ protected override void SetPadding()
273273
protected override void SetTextColor()
274274
{
275275
if (IsControlEnabled)
276-
txtEditor.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
276+
txtEditor.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
277277
else
278278
txtEditor.TextColor = DisabledTextColor;
279279
}

src/MaterialDesignControls/Controls/MaterialEntry.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ protected override void SetPadding()
433433
protected override void SetTextColor()
434434
{
435435
if (IsControlEnabled)
436-
txtEntry.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
436+
txtEntry.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
437437
else
438438
txtEntry.TextColor = DisabledTextColor;
439439
}

src/MaterialDesignControls/Controls/MaterialPicker.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ protected override void SetPadding()
258258
protected override void SetTextColor()
259259
{
260260
if (IsControlEnabled)
261-
pckOptions.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
261+
pckOptions.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
262262
else
263263
pckOptions.TextColor = DisabledTextColor;
264264
}

src/MaterialDesignControls/Controls/MaterialTimePicker.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected override void SetPadding()
153153
protected override void SetTextColor()
154154
{
155155
if (IsControlEnabled)
156-
pckTime.TextColor = IsControlFocused ? FocusedTextColor : TextColor;
156+
pckTime.TextColor = IsControlFocused && FocusedTextColor != Color.Transparent ? FocusedTextColor : TextColor;
157157
else
158158
pckTime.TextColor = DisabledTextColor;
159159
}

0 commit comments

Comments
 (0)