0
1

More than 3 years have passed since last update.

眺めて覚える C# Xamarin Forms(10) ListView

Posted at

スマートフォンで一番使うリストビューを解説します。

空のプロジェクトを作成します。

image.png

モバイルアプリを選択します。

image.png

プロジェクト名を指定して作成

image.png

空白を選択してOK

image.png

MainPage.xamlを開いて StackLayoutの部分を変更します。

MainPage.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"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="Xamarin_10.MainPage">
    <StackLayout Margin="20,35,20,20">
        <ListView>
        <ListView.ItemsSource>
            <x:Array Type="{x:Type x:String}">
                <x:String>東京</x:String>
                <x:String>神田</x:String>
                <x:String>お茶の水</x:String>
                <x:String>四谷</x:String>
                <x:String>新宿</x:String>
                <x:String>中野</x:String>
                <x:String>荻窪</x:String>
            </x:Array>
        </ListView.ItemsSource>
    </ListView>
    </StackLayout>

</ContentPage>

実行すると

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1