Pho*_*hop 3 c# xaml xamarin.android xamarin xamarin.forms
您好我正在开发使用xamarin表单构建的移动应用程序主页面是一个列表视图,其中列出了类别.我需要发生的是当用户点击列表视图中的项目时,它会在应用程序中打开新页面,而下面是xaml代码:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SchoolTools.HomePage">
<ListView HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame Padding="0,0,0,8" BackgroundColor="#d2d5d7">
<Frame.Content>
<Frame Padding="15,15,15,15" OutlineColor="Gray" BackgroundColor="White">
<Frame.Content>
<StackLayout Padding="20,0,0,0" Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
<Label x:Name="Internet" Text="Internet" HorizontalOptions="Center">
</Label>
<Label x:Name ="Math" Text="Math" HorizontalOptions="Center">
</Label>
<Label x:Name="Science" Text="Science" HorizontalOptions="Center">
</Label>
<Label x:Name ="Handwriting" Text="Handwriting" HorizontalOptions="Center">
</Label>
<Label x:Name ="FlashCards" Text="FlashCards" HorizontalOptions="Center">
</Label>
<Label x:Name="Books" Text="Books" HorizontalOptions="Center">
</Label>
</StackLayout>
</Frame.Content>
</Frame>
</Frame.Content>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
所以我的问题是什么代码beind使数学提交带你到MathToolsHome类?等等等等?
任何帮助都会很棒!
提前一百万!:)
为Listview定义ItemSelected:
<ListView HasUnevenRows="true"
ItemSelected="OnItemSelected">
Run Code Online (Sandbox Code Playgroud)
然后编写处理程序:
private void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var item = e.SelectedItem;
// Your code here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9033 次 |
| 最近记录: |