Skip to content

Commit faadc1d

Browse files
committed
NR: Enable some compiled bindings
1 parent 4e7a8f8 commit faadc1d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/NewsReader/NewsReader.Presentation/Views/FeedView.xaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<SwipeView>
3535
<SwipeView.LeftItems>
3636
<SwipeItems>
37-
<SwipeItem Command="{Binding BindingContext.ReadUnreadCommand, Source={Reference listView}}" CommandParameter="{Binding}"
37+
<SwipeItem Command="{Binding ReadUnreadCommand, Source={RelativeSource AncestorType={x:Type vm:FeedViewModel}}, x:DataType=vm:FeedViewModel}" CommandParameter="{Binding}"
3838
Text="{Binding MarkAsRead, Converter={Static c:MarkAsReadConverter.Instance}}" BackgroundColor="LightBlue">
3939
<SwipeItem.IconImageSource>
4040
<FontImageSource Glyph="&#xfb6e;" FontFamily="MaterialIcons" Color="Black" Size="48"/>
@@ -55,13 +55,13 @@
5555
<VerticalStackLayout Padding="10,5,10,10" Spacing="3" InputTransparent="False">
5656
<FlyoutBase.ContextFlyout>
5757
<MenuFlyout>
58-
<MenuFlyoutItem Command="{Binding BindingContext.ReadUnreadCommand, Source={Reference listView}}" CommandParameter="{Binding}"
58+
<MenuFlyoutItem Command="{Binding ReadUnreadCommand, Source={RelativeSource AncestorType={x:Type vm:FeedViewModel}}, x:DataType=vm:FeedViewModel}" CommandParameter="{Binding}"
5959
Text="{Binding MarkAsRead, Converter={Static c:MarkAsReadConverter.Instance}}"/>
6060
</MenuFlyout>
6161
</FlyoutBase.ContextFlyout>
6262

6363
<VerticalStackLayout.GestureRecognizers>
64-
<TapGestureRecognizer Command="{Binding BindingContext.ShowFeedItemViewCommand, Source={Reference listView}}" CommandParameter="{Binding}"/>
64+
<TapGestureRecognizer Command="{Binding ShowFeedItemViewCommand, Source={RelativeSource AncestorType={x:Type vm:FeedViewModel}}, x:DataType=vm:FeedViewModel}" CommandParameter="{Binding}"/>
6565
</VerticalStackLayout.GestureRecognizers>
6666

6767
<Label Text="{Binding Name}" Style="{StaticResource Title}" MaxLines="3">

src/NewsReader/NewsReader.Presentation/Views/ShellView.xaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
<SwipeView>
4343
<SwipeView.LeftItems>
4444
<SwipeItems>
45-
<SwipeItem Command="{Binding BindingContext.EditFeedCommand, Source={Reference listView}}" CommandParameter="{Binding}" Text="{x:Static p:Resources.Edit}">
45+
<SwipeItem Command="{Binding EditFeedCommand, Source={RelativeSource AncestorType={x:Type vm:ShellViewModel}}, x:DataType=vm:ShellViewModel}" CommandParameter="{Binding}" Text="{x:Static p:Resources.Edit}">
4646
<SwipeItem.IconImageSource>
4747
<FontImageSource Glyph="&#xf90b;" FontFamily="MaterialIcons"/>
4848
</SwipeItem.IconImageSource>
4949
</SwipeItem>
50-
<SwipeItem Command="{Binding BindingContext.RemoveFeedCommand, Source={Reference listView}}" CommandParameter="{Binding}" Text="{x:Static p:Resources.Remove}" IsDestructive="True" BackgroundColor="Red">
50+
<SwipeItem Command="{Binding RemoveFeedCommand, Source={RelativeSource AncestorType={x:Type vm:ShellViewModel}}, x:DataType=vm:ShellViewModel}" CommandParameter="{Binding}" Text="{x:Static p:Resources.Remove}" IsDestructive="True" BackgroundColor="Red">
5151
<SwipeItem.IconImageSource>
5252
<FontImageSource Glyph="&#xf1c0;" FontFamily="MaterialIcons"/>
5353
</SwipeItem.IconImageSource>
@@ -86,8 +86,8 @@
8686

8787
<FlyoutBase.ContextFlyout>
8888
<MenuFlyout>
89-
<MenuFlyoutItem Text="{x:Static p:Resources.Edit}" Command="{Binding BindingContext.EditFeedCommand, Source={Reference listView}}" CommandParameter="{Binding}"/>
90-
<MenuFlyoutItem Text="{x:Static p:Resources.Remove}" Command="{Binding BindingContext.RemoveFeedCommand, Source={Reference listView}}" CommandParameter="{Binding}"/>
89+
<MenuFlyoutItem Text="{x:Static p:Resources.Edit}" Command="{Binding EditFeedCommand, Source={RelativeSource AncestorType={x:Type vm:ShellViewModel}}, x:DataType=vm:ShellViewModel}" CommandParameter="{Binding}"/>
90+
<MenuFlyoutItem Text="{x:Static p:Resources.Remove}" Command="{Binding RemoveFeedCommand, Source={RelativeSource AncestorType={x:Type vm:ShellViewModel}}, x:DataType=vm:ShellViewModel}" CommandParameter="{Binding}"/>
9191
</MenuFlyout>
9292
</FlyoutBase.ContextFlyout>
9393

0 commit comments

Comments
 (0)