зеркало из https://github.com/DeGsoft/maui-linux.git
[Android, iOS] added re-measure of TimePicker after change value (#4999)
This commit is contained in:
Родитель
e7ca950176
Коммит
aef568a7c6
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 4961, "TimePicker does not remeasure its size when picking a new time that is wider than the previously selected value",
|
||||
PlatformAffected.Android | PlatformAffected.iOS)]
|
||||
public class Issue4961 : TestContentPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = "When changing the Time of the TimePicker the control should be remeasured and its size may change. " +
|
||||
"Set the time to 12:50 AM and check that the text does not get out of the screen."
|
||||
},
|
||||
new TimePicker
|
||||
{
|
||||
Time = TimeSpan.FromHours(1),
|
||||
HorizontalOptions = LayoutOptions.EndAndExpand,
|
||||
VerticalOptions = LayoutOptions.Start
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
<DependentUpon>Issue1588.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4961.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4629.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4384.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4782.cs" />
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace Xamarin.Forms.Platform.Android
|
|||
void TimePickerDialog.IOnTimeSetListener.OnTimeSet(ATimePicker view, int hourOfDay, int minute)
|
||||
{
|
||||
ElementController.SetValueFromRenderer(TimePicker.TimeProperty, new TimeSpan(hourOfDay, minute, 0));
|
||||
|
||||
ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
|
||||
|
||||
if (Forms.IsLollipopOrNewer)
|
||||
|
@ -134,6 +133,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
var timeFormat = Is24HourView ? "HH:mm" : Element.Format;
|
||||
EditText.Text = DateTime.Today.Add(time).ToString(timeFormat);
|
||||
Element.InvalidateMeasureNonVirtual(Internals.InvalidationTrigger.MeasureChanged);
|
||||
}
|
||||
|
||||
void UpdateFont()
|
||||
|
|
|
@ -159,6 +159,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
{
|
||||
_picker.Date = new DateTime(1, 1, 1).Add(Element.Time).ToNSDate();
|
||||
Control.Text = DateTime.Today.Add(Element.Time).ToString(Element.Format);
|
||||
Element.InvalidateMeasureNonVirtual(Internals.InvalidationTrigger.MeasureChanged);
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче