Visual Studio / WPF > DataGrid > DataGridComboBoxColumn > sys:String型として定義した文字列をXAMLで指定して使う

```txt:動作環境
Windows 7 Pro (32bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2
```

[Visual Studio / WPF > DataGridView > DataGridComboBoxColumn > public enumで定義したリストをXAMLで指定して使う](http://qiita.com/7of9/items/2851a6098b04059afd27)ではenum定義した値を使った。
文字列型を使いたい。

ObjectDataProvider を使う方法では失敗し、`x:Array`の方法では成功した。

参考: http://stackoverflow.com/questions/4739357/is-it-possible-to-make-an-liststring-a-static-resource-in-xaml

```xml:XAML
<Window x:Class="_170421_t1510_WpfDataGridComboBox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:_170421_t1510_WpfDataGridComboBox"
        xmlns:sys="clr-namespace:System;assembly=mscorlib" 
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <x:Array x:Key="myGenderSource" Type="sys:String">
            <sys:String>Male</sys:String>
            <sys:String>Female</sys:String>
        </x:Array>
    </Window.Resources>
    
    <Grid>
        <DataGrid x:Name="dataGridView1" HorizontalAlignment="Left" Height="211" Margin="10,10,0,0" VerticalAlignment="Top" Width="497">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
                <DataGridComboBoxColumn Width="100" x:Name="Gender"
                                        Header="Gender"
                                        ItemsSource="{Binding Source={StaticResource myGenderSource}}"
                                        SelectedValueBinding="{Binding Gender, Mode=TwoWay}"
                                        DisplayMemberPath="{Binding Gender}"/>
            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</Window>
```

```MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _170421_t1510_WpfDataGridComboBox
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            dataGridView1.Items.Add(new Employee { Name = "7of9", Gender = "Female" });
            dataGridView1.Items.Add(new Employee { Name = "Chakotay", Gender = "Male" });
            //dataGridView1.Items.Add(new Employee { Name = "Odo", Gender = "Unknown" });
        }
    }
    public class Employee
    {
        public string Name { get; set; }
        public string Gender { get; set; }
    }
}
```

![work.png](https://qiita-image-store.s3.amazonaws.com/0/32870/b826cf10-1a43-50bd-0d6c-220cf349098c.png)