Fix 59896; Add empty listView group twice (#1275)
This commit is contained in:
Родитель
4591700b1f
Коммит
f7e554e4d7
|
@ -40,16 +40,20 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
|
||||
private void GetItems()
|
||||
{
|
||||
var zeroGroup = new Grouping<string, GroupedItem>("Group 0", new List<GroupedItem> {
|
||||
});
|
||||
|
||||
var firstGroup = new Grouping<string, GroupedItem>("Group 1", new List<GroupedItem> {
|
||||
new GroupedItem("Group 1", "Item 1"),
|
||||
new GroupedItem("Group 1", "Item 2")
|
||||
});
|
||||
new GroupedItem("Group 1", "Item 1"),
|
||||
new GroupedItem("Group 1", "Item 2")
|
||||
});
|
||||
|
||||
var secondGroup = new Grouping<string, GroupedItem>("Group 2", new List<GroupedItem> {
|
||||
new GroupedItem("Group 2", "Item 3"),
|
||||
new GroupedItem("Group 2", "Item 4")
|
||||
});
|
||||
new GroupedItem("Group 2", "Item 3"),
|
||||
new GroupedItem("Group 2", "Item 4")
|
||||
});
|
||||
|
||||
model.Add(zeroGroup);
|
||||
model.Add(firstGroup);
|
||||
model.Add(secondGroup);
|
||||
|
||||
|
|
|
@ -8,5 +8,6 @@ namespace Xamarin.Forms
|
|||
{
|
||||
event NotifyCollectionChangedEventHandler CollectionChanged;
|
||||
IEnumerable ProxiedEnumerable { get; }
|
||||
bool TryGetValue(int index, out object value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -436,6 +436,9 @@ namespace Xamarin.Forms
|
|||
|
||||
#region IList
|
||||
|
||||
bool IListProxy.TryGetValue(int index, out object value)
|
||||
=> TryGetValue(index, out value);
|
||||
|
||||
object IList.this[int index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
|
|
|
@ -666,13 +666,16 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
}
|
||||
|
||||
// We're going to base our estimate off of the first cell
|
||||
Cell firstCell;
|
||||
var isGroupingEnabled = List.IsGroupingEnabled;
|
||||
|
||||
if (isGroupingEnabled)
|
||||
firstCell = templatedItems.ActivateContent(0, templatedItems.GetGroup(0)?.ListProxy[0]);
|
||||
else
|
||||
firstCell = templatedItems.ActivateContent(0, templatedItems.ListProxy[0]);
|
||||
templatedItems = templatedItems.GetGroup(0);
|
||||
|
||||
object item = null;
|
||||
if (templatedItems == null || templatedItems.ListProxy.TryGetValue(0, out item) == false)
|
||||
return DefaultRowHeight;
|
||||
|
||||
var firstCell = templatedItems.ActivateContent(0, item);
|
||||
|
||||
// Let's skip this optimization for grouped lists. It will likely cause more trouble than it's worth.
|
||||
if (firstCell?.Height > 0 && !isGroupingEnabled)
|
||||
|
|
|
@ -46,5 +46,27 @@
|
|||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="TryGetValue">
|
||||
<MemberSignature Language="C#" Value="public bool TryGetValue (int index, out object value);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool TryGetValue(int32 index, object value) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="index" Type="System.Int32" />
|
||||
<Parameter Name="value" Type="System.Object&" RefType="out" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="index">To be added.</param>
|
||||
<param name="value">To be added.</param>
|
||||
<summary>To be added.</summary>
|
||||
<returns>To be added.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
|
|
Загрузка…
Ссылка в новой задаче