Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ListView行中的异常_C#_.net_Wpf_Listview - Fatal编程技术网

C# ListView行中的异常

C# ListView行中的异常,c#,.net,wpf,listview,C#,.net,Wpf,Listview,我有一个列表视图,第一列组件是单选按钮,第三列组件是文本框。第二列只是一个标签。这一切我都做得很好。 问题是我希望最后一行不同。我只想让第二列成为文本框而不是标签。listview的内容与XmlDataProvider绑定 这里是XmlDataProvider: <XmlDataProvider x:Key="Properties" XPath="/Info"> <x:XData> <Info xmlns="">

我有一个列表视图,第一列组件是单选按钮,第三列组件是文本框。第二列只是一个标签。这一切我都做得很好。 问题是我希望最后一行不同。我只想让第二列成为文本框而不是标签。listview的内容与XmlDataProvider绑定

这里是XmlDataProvider:

<XmlDataProvider x:Key="Properties" XPath="/Info">
    <x:XData>
        <Info xmlns="">
            <Property Name="Text" Value=""/>                
            <Property Name="Tooltip" Value=""/>             
            <Property Name="Enable" Value=""/>              
            <Property Name="Visible" Value=""/>             
            <Property Name="Focus" Value=""/>               
            <Property Name="Selected" Value=""/>            
            <Property Name="Count" Value=""/>               
            <Property Name="Item" Value=""/>                
            <Property Name="SelectedText" Value=""/>        
            <Property Name="SelectedIndex" Value=""/>       
            <Property Name="Complete" Value=""/>            
            <Property Name="Custom" Value=""/>
        </Info>
    </x:XData>
</XmlDataProvider>

以及ListView定义:

<ListView Name="lstProperties"  Margin="55 0 0 0" Style="{DynamicResource TsListView}"
    Grid.Row="2" Grid.RowSpan="7" Grid.ColumnSpan="4"
    ItemsSource="{Binding Source={StaticResource Properties}, XPath=Property}" 
    ItemContainerStyle="{DynamicResource TsListViewItem}" 
    ScrollViewer.HorizontalScrollBarVisibility="Hidden"
    SelectionMode="Single" IsEnabled="False"
    SelectionChanged="propertySelected" 
    >

    <ListView.View>
        <GridView AllowsColumnReorder="False">
            <GridViewColumn CellTemplate="{StaticResource FirstCell}" Width="25" />
            <GridViewColumn Header="Property" Width="80">
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Label Style="{DynamicResource TsLabel}" Height="25" Width="115" Content="{Binding XPath=@Name}" />
                </DataTemplate>
            </GridViewColumn.CellTemplate>
                </GridViewColumn>
            <GridViewColumn Header="Value" Width="130">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBox Style="{DynamicResource TsHelperTextBox}"
                                 Height="20" Width="115" Text="{Binding XPath=@Value}" 
                                 IsEnabled="{Binding ElementName=rbTypeAssert, Path=IsChecked}" GotFocus="gridTextBox_GotFocus" />
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

我希望属性自定义显示在文本框中,而不是标签中


谢谢你的帮助

我得到了一个最有效的答案