Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 1, 2024. It is now read-only.
/Xamarin.FormsPublic archive

Commit6293975

Browse files
authored
[Android] Fix issue with BoxView Color and CornerRadius (#12069)
* Added repro sample* Fix the issue* Fixed build error
1 parent6153378 commit6293975

File tree

3 files changed

+65
-5
lines changed

3 files changed

+65
-5
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
usingXamarin.Forms.Internals;
2+
usingXamarin.Forms.CustomAttributes;
3+
4+
#ifUITEST
5+
usingXamarin.UITest;
6+
usingNUnit.Framework;
7+
usingXamarin.Forms.Core.UITests;
8+
#endif
9+
10+
namespaceXamarin.Forms.Controls.Issues
11+
{
12+
#ifUITEST
13+
[Category(UITestCategories.BoxView)]
14+
#endif
15+
[Preserve(AllMembers=true)]
16+
[Issue(IssueTracker.Github,12061,
17+
"[Bug] [Android] BoxView color is cleared when updating corner radius",
18+
PlatformAffected.Android)]
19+
publicclassIssue12061:TestContentPage
20+
{
21+
publicIssue12061()
22+
{
23+
}
24+
25+
protectedoverridevoidInit()
26+
{
27+
Title="Issue 12061";
28+
29+
varlayout=newStackLayout();
30+
31+
varinstructions=newLabel
32+
{
33+
Padding=12,
34+
BackgroundColor=Color.Black,
35+
TextColor=Color.White,
36+
Text="Tap the Button. The BoxView must be updated with ConerRadius but without losing the Color. If the BoxView Color is kept, the test has passed."
37+
};
38+
39+
varboxView=newBoxView
40+
{
41+
CornerRadius=0,
42+
Color=Color.Red,
43+
HeightRequest=60
44+
};
45+
46+
varbutton=newButton
47+
{
48+
Text="Update CornerRadius"
49+
};
50+
51+
layout.Children.Add(instructions);
52+
layout.Children.Add(boxView);
53+
layout.Children.Add(button);
54+
55+
Content=layout;
56+
57+
button.Clicked+=(sender,args)=>
58+
{
59+
boxView.CornerRadius=12;
60+
};
61+
}
62+
}
63+
}

‎Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,7 @@
17321732
</Compile>
17331733
<CompileInclude="$(MSBuildThisFileDirectory)Issue11869.cs" />
17341734
<CompileInclude="$(MSBuildThisFileDirectory)Issue11723.cs" />
1735+
<CompileInclude="$(MSBuildThisFileDirectory)Issue12061.cs" />
17351736
<CompileInclude="$(MSBuildThisFileDirectory)Issue11155.cs" />
17361737
<CompileInclude="$(MSBuildThisFileDirectory)Issue11643.xaml.cs" />
17371738
<CompileInclude="$(MSBuildThisFileDirectory)HeaderFooterShellFlyout.cs" />

‎Xamarin.Forms.Platform.Android/Renderers/BoxRenderer.cs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
5252

5353
base.OnElementPropertyChanged(sender,e);
5454

55-
if(e.IsOneOf(VisualElement.BackgroundColorProperty,VisualElement.BackgroundProperty,BoxView.ColorProperty))
55+
if(e.IsOneOf(VisualElement.BackgroundColorProperty,VisualElement.BackgroundProperty,BoxView.ColorProperty,BoxView.CornerRadiusProperty))
5656
UpdateBoxView();
57-
elseif(e.PropertyName==BoxView.CornerRadiusProperty.PropertyName)
58-
UpdateCornerRadius();
5957
}
6058

6159
protectedoverridevoidUpdateBackgroundColor()
@@ -179,8 +177,6 @@ void UpdateCornerRadius()
179177
backgroundGradient.SetCornerRadii(cornerRadii);
180178
}
181179
}
182-
183-
UpdateBackgroundColor();
184180
}
185181
}
186182
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp