Visual Studio / WPF > IDE > link > VisualStudioでクラスがどこの名前空間にあるのか確かめる方法

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

### 作成途中のコード

```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;
using System.Collections.ObjectModel;

namespace _170425_t1030_dataGrid
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var data = new ObservableCollection<Member>();
            data.Add(new Member { Name = "7of9", Species = Species.Borg, Age = 20, comment = "1"});
            data.Add(new Member { Name = "Janeway", Species = Species.Human, Age = 20, comment = "2" });
            data.Add(new Member { Name = "Odo", Species = Species.Unknown, Age = 20, comment = "3" });
            dataGrid.ItemsSource = data;
        }

        public enum Species
        {
            Unknown = 0,
            Human,
            Android,
            Borg,
        }
        public class Member
        {
            public string Name { get; set; }
            public Species Species { get; set; }
            public int Age { get; set; }
            public string comment { get; set; }
        }

        private void dataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "Name":
                    e.Column.Header = "名前";
                    e.Column.DisplayIndex = 0;
                    break;
                case "Species":
                    e.Column.Header = "種族";
                    e.Column.DisplayIndex = 1;
                    break;
                case "Age":
                    e.Cancel = true;
                    break;
                case "comment":
                    e.Column.Header = "備考";
                    e.Column.DisplayIndex = 2;
                    break;
            }
        }

        public class SpeciesComboBoxItem
        {
            public string Label { get; set; }
            public Species Value { get; set; }
        }
    }

}
```

```xml:XAML
<Window x:Class="_170425_t1030_dataGrid.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:_170425_t1030_dataGrid"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Height="181" Margin="21,21,0,0" VerticalAlignment="Top" Width="465" AutoGeneratingColumn="dataGrid_AutoGeneratingColumn">
            <DataGrid.Columns>
                <DataGridComboBoxColumn Header="シュゾク">
                    <DataGridComboBoxColumn.ItemsSource>
                        <!-- TODO: x:Arrayの定義 -->
                        <x:Array Type="{x:Type local:SpeciesComboBoxItem}">
                            
                        </x:Array>
                    </DataGridComboBoxColumn.ItemsSource>                
                </DataGridComboBoxColumn>
            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</Window>
```

### エラー
> 重大度レベル	コード	説明	プロジェクト	ファイル	行	抑制状態
エラー		名前 "SpeciesComboBoxItem" は名前空間 "clr-namespace:_170425_t1030_dataGrid" に存在しません。	

### 疑問

SpeciesComboBoxItemはどの名前空間に属するのか?

参考: [VisualStudioでクラスがどこの名前空間にあるのか確かめる方法 by shirakamisautoさん](http://shirakamisauto.hatenablog.com/entry/2015/06/29/144514)

見てみた。
![work.png](https://qiita-image-store.s3.amazonaws.com/0/32870/0601c74e-f70d-8fe3-7dfa-addcdd089474.png)

localの定義は以下なので、確かにlocalには見つからない。

```
xmlns:local="clr-namespace:_170425_t1030_dataGrid"
```

### エラー修正コード

名前空間を考慮して以下のようにすることでlocalにSpeciesComboBoxItemが見えるようになった。


```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;
using System.Collections.ObjectModel;

namespace _170425_t1030_dataGrid
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var data = new ObservableCollection<Member>();
            data.Add(new Member { Name = "7of9", Species = Species.Borg, Age = 20, comment = "1"});
            data.Add(new Member { Name = "Janeway", Species = Species.Human, Age = 20, comment = "2" });
            data.Add(new Member { Name = "Odo", Species = Species.Unknown, Age = 20, comment = "3" });
            dataGrid.ItemsSource = data;
        }

        public class Member
        {
            public string Name { get; set; }
            public Species Species { get; set; }
            public int Age { get; set; }
            public string comment { get; set; }
        }

        private void dataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "Name":
                    e.Column.Header = "名前";
                    e.Column.DisplayIndex = 0;
                    break;
                case "Species":
                    e.Column.Header = "種族";
                    e.Column.DisplayIndex = 1;
                    break;
                case "Age":
                    e.Cancel = true;
                    break;
                case "comment":
                    e.Column.Header = "備考";
                    e.Column.DisplayIndex = 2;
                    break;
            }
        }
    }

    public enum Species
    {
        Unknown = 0,
        Human,
        Android,
        Borg,
    }

    public class SpeciesComboBoxItem
    {
        public string Label { get; set; }
        public Species Value { get; set; }
    }
}
```