Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit f2820b0

Browse files
committed
Added cast SwipeView issue fix
1 parent 67b4cc1 commit f2820b0

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Xamarin.Forms.Core/SwipeView.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ public static void VerifySwipeViewFlagEnabled(
2929
propertyChanged: OnSwipeItemsChanged);
3030

3131
public static readonly BindableProperty RightItemsProperty =
32-
BindableProperty.Create(nameof(RightItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator);
32+
BindableProperty.Create(nameof(RightItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator,
33+
propertyChanged: OnSwipeItemsChanged);
3334

3435
public static readonly BindableProperty TopItemsProperty =
35-
BindableProperty.Create(nameof(TopItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator);
36+
BindableProperty.Create(nameof(TopItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator,
37+
propertyChanged: OnSwipeItemsChanged);
3638

3739
public static readonly BindableProperty BottomItemsProperty =
38-
BindableProperty.Create(nameof(BottomItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator);
40+
BindableProperty.Create(nameof(BottomItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator,
41+
propertyChanged: OnSwipeItemsChanged);
3942

4043
public SwipeItems LeftItems
4144
{
@@ -117,8 +120,14 @@ void UpdateSwipeItemsParent(SwipeItems swipeItems)
117120
{
118121
swipeItems.Parent = this;
119122

120-
foreach (var swipeItem in swipeItems)
121-
((VisualElement)swipeItem).Parent = swipeItems;
123+
foreach (var item in swipeItems)
124+
{
125+
if(item is SwipeItem swipeItem)
126+
swipeItem.Parent = swipeItems;
127+
128+
if (item is SwipeItemView swipeItemView)
129+
swipeItemView.Parent = swipeItems;
130+
}
122131
}
123132
}
124133
}

0 commit comments

Comments
 (0)