Xamarin.iOS のドキュメント
データマッピング
コントロール > FlexGrid > 機能 > データマッピング

データマッピングは、FlexGrid に自動検索機能を提供します。たとえば、顧客の ID の代わりに顧客名、RGB 値の代わりに色名を表示できます。データマッピングが設定されている場合は、その列内の任意のセルを編集する際に、ピッカーが表示されます。

データマップは、グリッドに自動検索機能を提供します。たとえば、顧客の CountryID の代わりに顧客の国、RGB 値の代わりに色名を表示できます。

次の図は、データマッピングが設定されている FlexGrid を示します。

以下のコードは、グリッドを顧客のコレクションに連結してから、DataMap をグリッドの「CountryID」列に割り当てて、グリッドに ID 自体ではなく国名を表示します。例では、「クイックスタート」セクションで作成したサンプルを使用します。

C#
コードのコピー
Grid.AutoGenerateColumns = false;
Grid.Columns.Add(new GridColumn { Binding = "Active", Width = new GridLength(70) });
Grid.Columns.Add(new GridColumn { Binding = "FirstName" });
Grid.Columns.Add(new GridColumn { Binding = "LastName" });
Grid.Columns.Add(new GridColumn { Binding = "OrderTotal", Format = "C", InputType = UIKeyboardType.NumbersAndPunctuation });
Grid.Columns.Add(new GridColumn { Binding = "CountryId", Header = "国" });
Grid.Columns["CountryId"].DataMap = new GridDataMap() { ItemsSource = Customer.GetCountries(), DisplayMemberPath = "Value", SelectedValuePath = "Key" };
Grid.ItemsSource = Customer.GetCustomerList(100);