1

我有一个列表视图项目

(XAML)

<ListView Name="myListView" BorderThickness="2,2,2,2" Margin="12,27,428,12">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="150" Header="Column1" DisplayMemberBinding="{Binding Test1}"/>
                <GridViewColumn Width="150" Header="Column2" DisplayMemberBinding="{Binding Test2}"/>
            </GridView>
        </ListView.View>
        <ListViewItem>
        </ListViewItem>
    </ListView>

并想用 2 个不同的数组填充它

string[] ApplicationNames
string[] ClassNames

但我很难这样做。谁能指出我正确的方向?

我正在使用 WPF

4

2 回答 2

2

您的问题的答案可能在此处找到。

WPF ApplicationPS 如果您在 XAML 中开发 UI ,那么您正在开发一个Winforms. Winforms应用程序是通过Windows Forms Application在选择项目类型时选择来创建的Visual Studio

于 2013-02-03T07:40:17.917 回答
1

XAML:

 <ListView Name="ResultListView">
      <ListView.View>
           <GridView>
              <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding ApplicationName }" Header="File" />
              <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding ClassName }"     Header="Location" />
           </GridView>
      </ListView.View>
 </ListView>

我的对象.cs

class MyObject
{
    public string ApplicationName { get; set; }
    public string ClassName { get; set; }
}

ObservableCollection<MyObject> results = new ObservableCollection<MyObject>();
//Populate some data into results here
ResultListView.ItemsSource =results;
于 2013-02-03T08:07:29.197 回答