1

I have a listview item

(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>

And want to fill it with 2 different arrays

string[] ApplicationNames
string[] ClassNames

but I'm having difficulty doing so. Can anyone point me in the right direction?

I'm using WPF

2 Answers 2

2

The answer to your question might be found here.

P.S. If you are developing UI in XAML, you are developing a WPF Application, not Winforms. Winforms applications are created by choosing Windows Forms Application when choosing the project type in Visual Studio.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks also for explaining the difference between WPF and WinForms!
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>

MyObject.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;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.