[Windows] Respect ClearButtonVisibility = ClearButtonVisibility.Never for <Entry>s#23158
Conversation
| } | ||
| else | ||
| { | ||
| deleteButton.RenderTransform = new UI.Xaml.Media.TranslateTransform() { Y = -1000 }; |
There was a problem hiding this comment.
It would be better to take into account parent's height, I guess. Or perhaps parent window height. Or something.
There was a problem hiding this comment.
What happens if you have entries in a scroll view... Will it be a floating button somewhere?
There was a problem hiding this comment.
First, one can modify src\Controls\samples\Controls.Sample.Sandbox\MainPage.xaml like this:
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.MainPage"
xmlns:local="clr-namespace:Maui.Controls.Sample">
<VerticalStackLayout Background="Lightgray">
<ScrollView BackgroundColor="Gray" WidthRequest="300" HeightRequest="300"
HorizontalScrollBarVisibility="Always" VerticalScrollBarVisibility="Always">
<Entry ClearButtonVisibility="Never" Text="Entry at your service" HeightRequest="30" Margin="0,1500,0,0" />
</ScrollView>
</VerticalStackLayout>
</ContentPage>to test the issue. And yes, you are right that the button was visible there.
I modified it like this 627e084. I'm aware it's still a workaround but in practice, it should work well.
An additional step can be to set deleteButton.Opacity = 0. But I don't find it good as it costs some performance.
My conclusion is that this PR attempts to replace one workaround for another one (it is IMHO better). Hopefully, the WinUI team will provide a way to hide the button easily one day - that would be the best thing.
| else if (!isEnabled && contains) | ||
| states.Remove(buttonVisibleState); | ||
| return; | ||
| } |
There was a problem hiding this comment.
It feels like this is a workaround as well. So if the approach of this PR is ok, then it would be a replacement of a workaround for a workaround.
|
Could anyone run tests for this PR just to know if they pass or not? |
|
@mattleibow What do you think please? |
|
/rebase |
f2eeab9 to
5193b28
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
83dc2c1 to
627e084
Compare
|
@mattleibow Does it look better to you now? |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Are you able to add a UI test? I have a feeling this one is going to break randomly when we update wasdk. |
8cc9c2e to
5785a0a
Compare
I added 280f81c as the first commit so that one can easily check that the test fails without the new "workaround". The test is partially done according to #23112 and its Steps to Reproduce.
Yes, I can imagine that. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Thanks for the test, now to bend CI to our will and ask it to do the basic job of running the tests properly. |
|
So I can see that a screenshot must be added. Not sure if some other test genuinely failed. |
|
You can download the screenshots from the devops test attachments. Just go to the failed test and the attachments tab. Should be there. It is the one without the nav bars and status bars. |
5785a0a to
b16a52d
Compare
0968321 to
4f014f0
Compare
|
Added a Windows snapshot. No snapshot for macOS so far. |
|
|
||
| await Task.Delay(500); | ||
|
|
||
| VerifyScreenshot(); |
There was a problem hiding this comment.
macOS won't generate screen shots so I would just ignore this test on macOS
Do we need the 500 ms delays?
VerifyScreenshot already does a delay and retry
There was a problem hiding this comment.
I don't think that the delay before VerifyScreenshot() is necessary I just wanted to be sure.
The previous delay, I'm not sure. It's very hard for me to tell. I just find it safer with the delay. I guess you are concerned with the CI test time, right?
There was a problem hiding this comment.
Given that I have a limited set of tries, I play it safe. :)
There was a problem hiding this comment.
I attempted to change it in 67b3766.
Unfortunately, for some reason I'm seeing locally
Severity Code Description Project File Line Suppression State
Error (active) NETSDK1047 Assets file 'D:\maui\artifacts\obj\Controls.TestCases.HostApp\project.assets.json' doesn't have a target for 'net8.0-ios/ios-arm64'. Ensure that restore has run and that you have included 'net8.0-ios' in the TargetFrameworks for your project. You may also need to include 'ios-arm64' in your project's RuntimeIdentifiers. Controls.TestCases.HostApp (net8.0-ios) C:\Program Files\dotnet\sdk\8.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 266
So I can't run the test locally.
There was a problem hiding this comment.
Ok, I think that running tests can be fixed by this line in my other PR: https://github.com/dotnet/maui/pull/23474/files#diff-349e2d81d37196ffda15df237504c8df756b681fedeb65bb511e636f260e4dd6R75
4f014f0 to
67b3766
Compare
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Trying the tests on Windows Core unpackaged again... Probably not related since the packaged version ran. But just to be safe. Might just merge if it fails again and see if main fixes it. |
|
Well, now it is green so whatever CI. |



Description of Change
The style interception code works sometimes but not always.
Relevant XAML template in WinUI 3 is here.
Issues Fixed
Fixes #23112
Related to #13714
PR that introduced the modified code: #3444