ListView and List Items


02-18-2008, 6:17 AM
Hello,

I'm afraid I have absolutely no idea how you use the ListTool in c# and Sharpui v1.4

I have added a list view item to the menu bar and it shows up in the menu as ListTool1.

My first question is, there are also list items, what are they, how do I create them in code and how do I show them. Is there a way of checking which one has been clicked.

Second question, When I create the listitems in the desgner they still don't show up. Why not, where do I go to display them and where are they displayed.

If I want to create items for a user to select in a menu do I create several ListViews or do I create one list view and several ListItems?

Are there any Examples of using the LsitView anywhere?

Thank you in advance for your help

Sandyw

Re: ListView and List Items


02-18-2008, 12:57 PM
Thank you for your questions. I will answer your questions in the order which they were presented.

1)    You can create list items programmatically by adding a new list item to the Tools Items collection.
Ex:
this.listTool1.Items.Add(new DataDynamics.SharpUI.Toolbars.ListItem("New Item in the List"));

(Link to code sample)
http://www.datadynamics.com/Help/SharpUI/SharpUI.Toolbars~DataDynamics.SharpUI.Toolbars.ListTool.html

Also, you can use the ListTools click event to determine what item was clicked by casting the sender as DataDynamics.SharpUI.Toolbars.Tool.

Ex:
private void listTool1_Click(object sender, System.EventArgs e)
{
    Console.WriteLine(((DataDynamics.SharpUI.Toolbars.Tool)sender).Text);
}

2)    You can determine how list items are displayed by setting the CaptionStyle and DisplayAs properties of the ListTool.
 
3)    Unfortunately, we do not have any samples demonstrating the use of a list tool, however, you can find a code snippet contained in the previous link as well as a small sample attached.

Thanks,
    Eric

Re: ListView and List Items


02-19-2008, 9:03 AM
Hello Ericc,

Thank you very much for your help.

It has cleared up the questions that I had. It's now a case of trying it.

Again

Thank You,

Sandyw