2010-03-02 52 views
0

我有一個ListView,第一列組件是RadioButtons,第三列是TextBoxs。第二列僅僅是一個標籤。我有這一切工作正常。 問題是我想要最後一行是不同的。我想要的只是第二列是TextBox而不是標籤。列表視圖的內容綁定了一個XmlDataProvider。ListView行中的異常

這是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 [email protected]}" /> 
       </DataTemplate> 
      </GridViewColumn.CellTemplate> 
       </GridViewColumn> 
      <GridViewColumn Header="Value" Width="130"> 
       <GridViewColumn.CellTemplate> 
        <DataTemplate> 
         <TextBox Style="{DynamicResource TsHelperTextBox}" 
           Height="20" Width="115" Text="{Binding [email protected]}" 
           IsEnabled="{Binding ElementName=rbTypeAssert, Path=IsChecked}" GotFocus="gridTextBox_GotFocus" /> 
        </DataTemplate> 
       </GridViewColumn.CellTemplate> 
      </GridViewColumn> 
     </GridView> 
    </ListView.View> 
</ListView> 

我想要的屬性自定義在一個文本框,而不是一個標籤來呈現。

感謝您的幫助!

回答