I am working on a simple window form program. The program has a ListView. I need to know which row in the ListView is selected. How I can do that?
Look in the documentation of the ListView class, there are various properties that start with Selected.
Related
I would like to ask a question regarding if it would be possible to make a toolbar like the droid tool bar's secondary items bar inside a listview? Picture shown below:
This is very easy to do. You can put this panel with menu in the header of the listview if you dont mind it to scroll up with the data. Or you can create a grid with 2 rows, put menu panel in row 0, put listview in row 1.
Your question is not very clear. If I understand it correctly, you would like to number the items of a list view.
This can be done by overriding the functionality of the getView() function.
Check for an example here
For some reason, i have this animation/effect by default when I press any items of my ListView (chat). I dont have any codes for that, it is just present/default.
Why is that? How can I turn it off or on?
It called "Ripple effect".
there are many related question in SO, see this https://stackoverflow.com/a/27237195/3814729 .
I just want to create a list with data and columns (sortable). I don't want tiles, I don't want right scrolling. I just want a list like the "Listview" Win32 common control. Or am I forced into the tile metaphor.
I believe they are not at a metaphor but from my point ListView in Win32 is one.
ListView in Win32 is a very limited control, unflexible and too ugly.
ListView and GridView xaml controls are far better aproach, I know.. switch from old style controls to new style is easy if you come from scratch but if you have old style background... is hard... I know.
If your lvw32 grows vertically based on data use a Listview (xaml) in wich each item is a Row and use the item template to put in a gridview,the gridview will be one register with all attributes (columns).
So your ListView will have a collection of Rows, each Row is a GridView who is a Collection of attributes.
This is a way, but you have a lot of different options.
Just like the UITableView on iphone.
users can remove or move a row on UITableView.
There is only one button to switch the UITableView to editing mode.
but for listbox on wp7 , I need 3 buttons, one for removing the selected row, one for moving the row up, one for moving the row down.
Welcome any comment
The Windows Phone ListBox doesn't support these features out of the box, but it would be possible to add them yourself using a DataTemplate.
Here's a blog post about creating a custom DataTemplate for your ListItems.
At a high level, you'll need to create a template that contains:
Enter edit mode button
Delete button
Sort up/down buttons
Then in your code, you'll need to toggle the visibility of the delete and sort buttons, as well as handle user clicks on each of the buttons. Doable, but a fair amount of work.
In my opinion, a better option would be to use a approach that's different from what you might be used to but is more familiar to Windows Phone users: the ContextMenu. This control allows you to pop up a menu when the user performs a long touch (tap-and-hold) on an item.
Here's a good tutorial about incorporating this control into your app.
Take a look at re-order ListBox here. It shows how to retemplate the ListBox.
For removing on item, you just need to remove its data source item. See how to use ObservableCollection.
If you want to show effect when an item is removed, use Event Triggers for the Unloaded event.
I am working in MVC and I want to show my data in an asp GridView and I also want to change the row backcolor whenever mouse hover that particular row. Please let me know how can I do that.
Thanks in advance,
gbhatnagar.
Use Javascript (JQUERY!) and have an on hover event for the row. So when hovered over, you switch the previously highlighted row go back to normal and change the colour of the current row.
You could easily do it with Jquery and by having a row css class and a highlighted row css class.