Merge branch '3.0.0' into fix-gh2332
This commit is contained in:
Коммит
f259ae2abf
|
@ -15,6 +15,8 @@ namespace Xamarin.Forms.Controls
|
|||
readonly ListView _listView;
|
||||
protected abstract DataTemplate CellTemplate();
|
||||
|
||||
_43313ViewModel ViewModel => BindingContext as _43313ViewModel;
|
||||
|
||||
protected Bugzilla43313_Template()
|
||||
{
|
||||
BindingContext = new _43313ViewModel();
|
||||
|
@ -48,7 +50,7 @@ namespace Xamarin.Forms.Controls
|
|||
ItemTemplate = CellTemplate()
|
||||
};
|
||||
|
||||
_listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ListViewContent"));
|
||||
_listView.SetBinding(ListView.ItemsSourceProperty, new Binding(nameof(_43313ViewModel.ListViewContent)));
|
||||
_listView.ItemTapped += (sender, e) => ((ListView)sender).SelectedItem = null;
|
||||
|
||||
var instructions = new Label() { FontSize = 12, Text = "Tap the 'Add Item' button; a new item should be added to the bottom of the list and the list should scroll smoothly to display it. If the list scrolls back to the top before scrolling down to the new item, the test has failed." };
|
||||
|
@ -69,14 +71,14 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
string str = $"Item {ItemCount++}";
|
||||
var item = new _43313Model { Name = str };
|
||||
(BindingContext as _43313ViewModel).ListViewContent.Add(item);
|
||||
ViewModel.ListViewContent.Add(item);
|
||||
|
||||
_listView.ScrollTo(item, ScrollToPosition.End, true);
|
||||
}
|
||||
|
||||
void BtnBottomOnClicked(object sender, EventArgs e)
|
||||
{
|
||||
_43313Model item = (BindingContext as _43313ViewModel).ListViewContent.Last();
|
||||
_43313Model item = ViewModel.ListViewContent.Last();
|
||||
_listView.ScrollTo(item, ScrollToPosition.End, true);
|
||||
}
|
||||
|
||||
|
@ -129,7 +131,7 @@ namespace Xamarin.Forms.Controls
|
|||
return new DataTemplate(() =>
|
||||
{
|
||||
var label = new Label { FontSize = 16, VerticalOptions = LayoutOptions.Center };
|
||||
label.SetBinding(Label.TextProperty, "Name");
|
||||
label.SetBinding(Label.TextProperty, nameof(_43313Model.Name));
|
||||
int height = 60 + new Random().Next(10, 100);
|
||||
|
||||
return new ViewCell
|
||||
|
@ -157,7 +159,7 @@ namespace Xamarin.Forms.Controls
|
|||
return new DataTemplate(() =>
|
||||
{
|
||||
var label = new Label { FontSize = 16, VerticalOptions = LayoutOptions.Center };
|
||||
label.SetBinding(Label.TextProperty, "Name");
|
||||
label.SetBinding(Label.TextProperty, nameof(_43313Model.Name));
|
||||
|
||||
label.FontSize = 12 + new Random().Next(1, 6);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
protected override void Init()
|
||||
{
|
||||
var button = new Button { Text = "Click to call DisplayAlert twice" };
|
||||
var button = new Button { Text = "Click to call DisplayAlert three times" };
|
||||
|
||||
button.Clicked += (sender, args) =>
|
||||
{
|
||||
|
@ -29,6 +29,11 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
await DisplayAlert("Second", "Text", "Cancel");
|
||||
}));
|
||||
|
||||
Device.BeginInvokeOnMainThread(new Action(async () =>
|
||||
{
|
||||
await DisplayAlert("Three", "Text", "Cancel");
|
||||
}));
|
||||
};
|
||||
|
||||
Content = button;
|
||||
|
|
|
@ -86,6 +86,8 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
List.DataContext =
|
||||
new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled };
|
||||
}
|
||||
|
||||
List.UpdateLayout();
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
public abstract partial class Platform
|
||||
{
|
||||
internal static StatusBar MobileStatusBar => ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") ? StatusBar.GetForCurrentView() : null;
|
||||
static Task<bool> s_currentAlert;
|
||||
|
||||
IToolbarProvider _toolbarProvider;
|
||||
|
||||
|
@ -102,12 +103,21 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
if (options.Accept != null)
|
||||
alertDialog.PrimaryButtonText = options.Accept;
|
||||
|
||||
ContentDialogResult result = await alertDialog.ShowAsync();
|
||||
while (s_currentAlert != null)
|
||||
{
|
||||
await s_currentAlert;
|
||||
}
|
||||
|
||||
if (result == ContentDialogResult.Secondary)
|
||||
options.SetResult(false);
|
||||
else if (result == ContentDialogResult.Primary)
|
||||
options.SetResult(true);
|
||||
s_currentAlert = ShowAlert(alertDialog);
|
||||
options.SetResult(await s_currentAlert);
|
||||
s_currentAlert = null;
|
||||
}
|
||||
|
||||
static async Task<bool> ShowAlert(ContentDialog alert)
|
||||
{
|
||||
ContentDialogResult result = await alert.ShowAsync();
|
||||
|
||||
return result == ContentDialogResult.Primary;
|
||||
}
|
||||
|
||||
void ClearCommandBar()
|
||||
|
|
Загрузка…
Ссылка в новой задаче