如何解决一个页面中有两个本地视图 - 如何实现?可见导航
我正在为一页中的两张底页 (BS) 苦苦挣扎。在第一个我想从 ListView 中选择(点击)带有名称和编号的项目,单击后 BS1 将隐藏,BS2 将在同一位置查看,带有两个标签(我选择的名称和编号)。
我应该在哪里写这个逻辑?在 MainPage.cs 中还是在 BottomSheet1.cs 和 BottomSheet2.cs 中? 或者您有其他想法?
我正在使用的底部工作表:http://xamaringuyshow.com/2020/06/21/xamarin-forms-bottom-slider/
MainPage.xaml
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<maps:Map x:Name="map" BackgroundColor="Gray" HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="0" Grid.RowSpan="4"/>
<local:BottomSheet1 x:Name="BottomSheetPanCakeLocal" VerticalOptions="EndAndExpand" Grid.Row="1" Grid.RowSpan="3"></local:BottomSheetPanCake>
<local:BottomSheet2 x:Name="BottomSheetUnitPanCakeLocal" Grid.Row="1" Grid.RowSpan="3" VerticalOptions="EndAndExpand"></local:BottomSheetUnitPanCake>
</Grid>
</ContentPage>
BottomSheet1.xaml
<RelativeLayout>
<Grid>
<ListView x:Name="UnitList" ItemsSource="{Binding Units}" RowHeight="60" ItemTapped="UnitList_ItemTapped" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80*" ></ColumnDefinition>
<ColumnDefinition Width="20*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Text="{Binding name}" Grid.Row="0" Grid.Column="0" Margin="15,10,0" Style="{StaticResource HighlightedTextsFont}" FontAttributes="Bold"></Label>
<Label Text="{Binding number}" Grid.Row="1" Grid.Column="0" Margin="15,-3,12" Style="{StaticResource secondaryHeader}" ></Label>
<Label Text=">" Grid.RowSpan="2" Grid.Column="1" HorizontalOptions="End" VerticalOptions="Center" TextColor="Gray" Padding="15"></Label>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</RelativeLayout>
BottomSheet2.xaml
<RelativeLayout>
<Grid>
<Label Text="{Binding name}" Grid.Row="0" Grid.Column="0" Style="{StaticResource mainHeader}" ></Label>
<Label Text="{Binding number}" Grid.Row="1" Grid.Column="0" Style="{StaticResource secondaryHeader}" ></Label>
</Grid>
</RelativeLayout>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。