回答編集履歴
1
見直しキャンペーン中
    
        answer	
    CHANGED
    
    | 
         @@ -1,47 +1,47 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            `XmlDataProvider`での書き方とごっちゃになっています。
         
     | 
| 
      
 1 
     | 
    
         
            +
            `XmlDataProvider`での書き方とごっちゃになっています。
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       3 
     | 
    
         
            -
            (上)xamlのほうを採用するなら、`XmlDataProvider`を使ってください。
         
     | 
| 
      
 3 
     | 
    
         
            +
            (上)xamlのほうを採用するなら、`XmlDataProvider`を使ってください。
         
     | 
| 
       4 
     | 
    
         
            -
            (下)コードのほうを採用するなら、`XPath`でなく`Path`(あるいは省略`"{Binding Name}"`)になります。
         
     | 
| 
      
 4 
     | 
    
         
            +
            (下)コードのほうを採用するなら、`XPath`でなく`Path`(あるいは省略`"{Binding Name}"`)になります。
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       6 
     | 
    
         
            -
            ``` 
     | 
| 
      
 6 
     | 
    
         
            +
            ```xml
         
     | 
| 
       7 
     | 
    
         
            -
            <Window
         
     | 
| 
      
 7 
     | 
    
         
            +
            <Window
         
     | 
| 
       8 
     | 
    
         
            -
              x:Class="Questions299871.MainWindow"
         
     | 
| 
      
 8 
     | 
    
         
            +
              x:Class="Questions299871.MainWindow"
         
     | 
| 
       9 
     | 
    
         
            -
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         
     | 
| 
      
 9 
     | 
    
         
            +
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         
     | 
| 
       10 
     | 
    
         
            -
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         
     | 
| 
      
 10 
     | 
    
         
            +
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         
     | 
| 
       11 
     | 
    
         
            -
              Width="800"
         
     | 
| 
      
 11 
     | 
    
         
            +
              Width="800"
         
     | 
| 
       12 
     | 
    
         
            -
              Height="450">
         
     | 
| 
      
 12 
     | 
    
         
            +
              Height="450">
         
     | 
| 
       13 
     | 
    
         
            -
              <Grid Margin="10">
         
     | 
| 
      
 13 
     | 
    
         
            +
              <Grid Margin="10">
         
     | 
| 
       14 
     | 
    
         
            -
                <Grid.RowDefinitions>
         
     | 
| 
      
 14 
     | 
    
         
            +
                <Grid.RowDefinitions>
         
     | 
| 
       15 
     | 
    
         
            -
                  <RowDefinition />
         
     | 
| 
      
 15 
     | 
    
         
            +
                  <RowDefinition />
         
     | 
| 
       16 
     | 
    
         
            -
                  <RowDefinition />
         
     | 
| 
      
 16 
     | 
    
         
            +
                  <RowDefinition />
         
     | 
| 
       17 
     | 
    
         
            -
                </Grid.RowDefinitions>
         
     | 
| 
      
 17 
     | 
    
         
            +
                </Grid.RowDefinitions>
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       19 
     | 
    
         
            -
                <!--  XmlDataProvider  -->
         
     | 
| 
      
 19 
     | 
    
         
            +
                <!--  XmlDataProvider  -->
         
     | 
| 
       20 
     | 
    
         
            -
                <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding XPath=/Products/Product}">
         
     | 
| 
      
 20 
     | 
    
         
            +
                <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding XPath=/Products/Product}">
         
     | 
| 
       21 
     | 
    
         
            -
                  <DataGrid.DataContext>
         
     | 
| 
      
 21 
     | 
    
         
            +
                  <DataGrid.DataContext>
         
     | 
| 
       22 
     | 
    
         
            -
                    <!--
         
     | 
| 
      
 22 
     | 
    
         
            +
                    <!--
         
     | 
| 
       23 
     | 
    
         
            -
                      Practice.xmlのプロパティ
         
     | 
| 
      
 23 
     | 
    
         
            +
                      Practice.xmlのプロパティ
         
     | 
| 
       24 
     | 
    
         
            -
                      ビルドアクション:Resource だとこっちは読めるが↓のDataGridは読めない
         
     | 
| 
      
 24 
     | 
    
         
            +
                      ビルドアクション:Resource だとこっちは読めるが↓のDataGridは読めない
         
     | 
| 
       25 
     | 
    
         
            -
                      ビルドアクション:コンテンツ&コピーする だと両方読めた
         
     | 
| 
      
 25 
     | 
    
         
            +
                      ビルドアクション:コンテンツ&コピーする だと両方読めた
         
     | 
| 
       26 
     | 
    
         
            -
                    -->
         
     | 
| 
      
 26 
     | 
    
         
            +
                    -->
         
     | 
| 
       27 
     | 
    
         
            -
                    <XmlDataProvider Source="Practice.xml" />
         
     | 
| 
      
 27 
     | 
    
         
            +
                    <XmlDataProvider Source="Practice.xml" />
         
     | 
| 
       28 
     | 
    
         
            -
                  </DataGrid.DataContext>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  </DataGrid.DataContext>
         
     | 
| 
       29 
     | 
    
         
            -
                  <DataGrid.Columns>
         
     | 
| 
      
 29 
     | 
    
         
            +
                  <DataGrid.Columns>
         
     | 
| 
       30 
     | 
    
         
            -
                    <DataGridTextColumn Binding="{Binding XPath=@Name}" Header="Name" />
         
     | 
| 
      
 30 
     | 
    
         
            +
                    <DataGridTextColumn Binding="{Binding XPath=@Name}" Header="Name" />
         
     | 
| 
       31 
     | 
    
         
            -
                    <DataGridTextColumn Binding="{Binding XPath=@Category}" Header="Category" />
         
     | 
| 
      
 31 
     | 
    
         
            +
                    <DataGridTextColumn Binding="{Binding XPath=@Category}" Header="Category" />
         
     | 
| 
       32 
     | 
    
         
            -
                  </DataGrid.Columns>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  </DataGrid.Columns>
         
     | 
| 
       33 
     | 
    
         
            -
                </DataGrid>
         
     | 
| 
      
 33 
     | 
    
         
            +
                </DataGrid>
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       35 
     | 
    
         
            -
                <!--  DataView  -->
         
     | 
| 
      
 35 
     | 
    
         
            +
                <!--  DataView  -->
         
     | 
| 
       36 
     | 
    
         
            -
                <DataGrid
         
     | 
| 
      
 36 
     | 
    
         
            +
                <DataGrid
         
     | 
| 
       37 
     | 
    
         
            -
                  x:Name="dataGrid"
         
     | 
| 
      
 37 
     | 
    
         
            +
                  x:Name="dataGrid"
         
     | 
| 
       38 
     | 
    
         
            -
                  Grid.Row="1"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  Grid.Row="1"
         
     | 
| 
       39 
     | 
    
         
            -
                  AutoGenerateColumns="False">
         
     | 
| 
      
 39 
     | 
    
         
            +
                  AutoGenerateColumns="False">
         
     | 
| 
       40 
     | 
    
         
            -
                  <DataGrid.Columns>
         
     | 
| 
      
 40 
     | 
    
         
            +
                  <DataGrid.Columns>
         
     | 
| 
       41 
     | 
    
         
            -
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" />
         
     | 
| 
      
 41 
     | 
    
         
            +
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" />
         
     | 
| 
       42 
     | 
    
         
            -
                    <DataGridTextColumn Binding="{Binding Path=Category}" Header="Category" />
         
     | 
| 
      
 42 
     | 
    
         
            +
                    <DataGridTextColumn Binding="{Binding Path=Category}" Header="Category" />
         
     | 
| 
       43 
     | 
    
         
            -
                  </DataGrid.Columns>
         
     | 
| 
      
 43 
     | 
    
         
            +
                  </DataGrid.Columns>
         
     | 
| 
       44 
     | 
    
         
            -
                </DataGrid>
         
     | 
| 
      
 44 
     | 
    
         
            +
                </DataGrid>
         
     | 
| 
       45 
     | 
    
         
            -
              </Grid>
         
     | 
| 
      
 45 
     | 
    
         
            +
              </Grid>
         
     | 
| 
       46 
     | 
    
         
            -
            </Window>
         
     | 
| 
      
 46 
     | 
    
         
            +
            </Window>
         
     | 
| 
       47 
47 
     | 
    
         
             
            ```
         
     |