I have a list of items. First I select an item from list then save it in local db. Now I want that when user open app next time. The save item should be default selected in the list. But no item is selecting default when user comes next time.
How is it possible in xamarin.forms to select an item default selected in listview?
You can set the Listview Selected Item in your code behind.
Assuming you have Binded your ItemsSource, you just need to get the object you want to set as selected and do this:
ListviewItems.SelectedItem = YourCollection[YourIndex];
Related
When I insert a new match after removing one from the collection view.
It remembers the last match's state.
here if I have selected Chelsea previously it will kept the 2nd option selected for the new entry
So I have CollectionItemView custom control defined and used in the collection view item template and the collection view is binded with an observable collection from which I remove the item upon removing item CollectionItemView disappears but when I insert new item in the observable collection the state of previously removed CollectionItemView restore itself.
Bind itemsource to an observablecollection and remove from/add to that. Any changes will impact the UI.
I have two listboxes, Listbox1 and Listbox2. When I select few values from Listbox1 to Listbox2 and hit save the first item on the listbox2 gets recorded into the database but I can see still see all the all the items on Listbox2 when I hit edit from saved list in webpage. Now when I want to clear listbox2 in edit mode i.e. move all the selected items in Listbox2 to list box 1 and hit save, database gets cleared, no values are saved but my Listbox2 donot clear those items. Any suggestions?
You can use Linq to set all the ListItems selections to false.
ListBox1.Items.Cast<ListItem>().ToList().ForEach(x => x.Selected = false);
I have a list of items with Actions drop-down for each item in the left-section of page. I also have a right rail which displays a different component based on action type selected. I'm using aux-route to accomplish this.
One of the Action the user can take is "edit" where in a form is displayed to edit the metadata of the list item. While editing, user can click on + button next to some of the input field to add another input field dynamically.
Now my problem is, when the edit-form is open for a list item and I click edit on another item in the list, I wanted my edit-component to be re-instantiated.
Because the aux-route is same for all the list items for edit-action, edit-view is not instantiated once again. Is there a way to achieve it?
Right now fixed it with RouteReuseStrategy
I have one flex datagrid which contains number of rows and column. I want to make selected row editable by clicking on edit button. Is it possible? I have try many samples but on that either entire datagrid is editable or particular row's single column is editable. Is there any way to make selected row editable by clicking on edit button?
You can get the selected row with the grid.selectedIndex property. One thought to you problem:
Add an "editable" property to you items in the datagrid which is false by default
When clicking on the button, set grid.selectedItem.editable = true;
Change the grid's item renderer to a new one, which displays TextInput fields if an item is editable or just plain Label if it's not
You can change the item renderer at runtime like this:
grid.itemRenderer = new ClassFactory(com.myapp.renderers.MyGridItemRenderer);
I just want to clarify, weather the feature is present or not in Qt.
The scenario is like this,
I have a list view with items, I want to place the icon to the listview when the item is selected.
The selection I mean is, first time when I click item should be selected, next time if I click the same item then it should display some icon. Please note
It is not the double click. again if do select some other item same feature should continue
So is there any feature which handles this feature by default, any property or flag which I need to set to listview to behave like this or manual implementation
Is required for this.
No problem (: Now I understand what you mean... So if you click on an item it should be selected (for example highlighted in blue) and then when you click on this item again, an icon should be displayed.
I can't think of a regualar way to do this, there is no such flag or something.
The easiest way I can think of would be to store the index in a QList when you select it. And when you deselect it, you delete the index from the list. SO, when you click on an item you can check if it is in that list and if so you can display your icon.
Another way would be to create your own type of QModelIndex. Everytime, this index is selected, you set a bool like is_already_selected on true. When clicking on this item again you check this bool and then decide whether an icon should be displayed or not.
For further information, see: QListView, QAbstractItemView::currentIndex, QModelIndex