I'm using the ListPicker control from the WP7 Toolkit. I want to initially present the list with no items selected. Is there a way of doing this?
According to this blog entry List Picker works with the idea of "there is always an active selection".
The approach I would follow is to have the first item in the list be you "no selected item" item. With appropriate values (maybe a null id) that you can identify later on.
By design ListPicker must have a selected item. If you try to set it to null or set the SelectedIndex to -1 you will get an exception.
Related
I am having a Long List Multi Selector with Grouping enabled to have jump list feeling for Windows Phone 8 app.
We can select maximum of 8 items in long list multi selector. After selecting the items the items can be seen checked and in code as well I am able to retrieve them via SelectedItems list.
But when I am trying to come back to that page again with same item source to Long List MultiSelector and trying to get Selected Items list pre-selected when Long List Multi Selector is opened the functionality is not happening.
PFB the sample code for the same:-
foreach (var item in SelectedValue)
MultiSelectLongList.SelectedItems.Add(item);
everything else is working correctly in Long List multi selector except for preselecting some items when list is opened.
Is there any other way of doing it. Please help me out.
Thanks
If you are using the Phone toolkit LongListMultiSelector control, this should actually just work.
But you are not showing a lot of code, so we can't see how you are keeping track of the objects and what objects are really set to the ItemsSource of the list.
As you can see in my screenshot, when I just load a LongList with some data and add that same data ( note the word same here because it needs to be the same reference ), the are preselected in the emulator.
If you don't have the correct reference you can itterate the itemssource with linq and get them through some key if needed.
2 ways I pre selected items
this.LongListSelector.SelectedItems.Add(data1);
this.LongListSelector.SelectedItems.Add(this.LongListSelector.ItemsSource[2]);
in a page 4 menus one by one like the below.
APPS
1.sample1
2.sample2
PERSONAL
1.info1
2.info2
Valuble
1.item1
2.item2.
More
1.item1
2.item2
like the above APPS,PERSONAL,Valuble,More these are Headings.in that items are binding from Sqlite DB.
intially there are no items .DB is creating .by click on button in that page navigating to another page here i'm binding categories[APPS,PERSONAL---] to combobox and one textbox is there.in that way i'm adding items to mainpage.
functionalty is ok but i taken four listboxes statically placed in that i'm binding the items.but intially no items while db creation.if whenever adding the PERSONAL item first the first listbox was empty and filling the second listbox.if whenever adding MORE items first ,the above listboxes are empty this is bad design i think.
How to design UI for that...
I would have thought this is is an ideal candidate for the LongList selector control of Windows Phone - similar to the contacts page.
Have a look here http://www.windowsphonegeek.com/articles/wp7-longlistselector-in-depth--part1-visual-structure-and-api
I haven't used it myself but would think that you should be able to use it to get the effect you require.
I am developing a wp7 application using longlist selector. My requirement is to change font of only some items on the screen. For this i need to get the text box control for the item.
The textbox is a part of item template of the long list selector.
The items to be modified change with the scroll.
I tried using the Link event. here i can find the contentpresenter for the item being added. But how can i get the textbox from the content presenter.
Any one can help with this? pls.
Instead of searching for the TextBlock that gets generated - provide your own in the ItemTemplate/DataTemplate and set its font through binding to an item in the ItemsSource. You can use a converter to determine the font or provide the font directly in each item of the bound collection.
the standard behaviour of a Flex dropdownlist is to disable the currently selected item from the list. Does anybody know how to override this to allow the user to re-select the selected item (if they so desire)?
NOTE: I don't want there to be a selected item in the list but I still want the selecteditem property to be set in the dropdownlist control, otherwise how will I know what has been selected. This is slighly trickier than it sounds...unless I have missed something...
Thanks
Mark
I'm not sure I understand the question but you can listen to close event of the component :
Dispatched when the drop-down list closes for any reason, such when the user: Selects an item in the drop-down list. Clicks outside of the drop-down list. Clicks the anchor button while the drop-down list is displayed.
So, you can access the component and gather the selectedIndex, selectedItem properties.
I guess what I'd like to know is that why you want to "re-select", possible to trigger something again but I'd try close event...
In Powerbuilder, Does anyone here know how am i going to highlights multiple items on a treeview? Selecteditem function is not doing that. Im looking for a behavior just what Selectedrow id doing.
Thanks!
I've not tried this myself but there is an example on CodeXchange (look for Multi-select TreeView Control).
I think the treeview style datawindow might be easier to do this with.
If not, I found this on the newsgroup, don't know if it helps:
The following script in the
selectionchanged event will implement
a very basic multiselect in the
treeview:
treeviewitem ltvi_item
if KeyDown(KeyControl!) then
This.GetItem(oldhandle, ltvi_Item)
ltvi_Item.Selected = True
This.SetItem(oldhandle, ltvi_Item)
end if
A problem is deselecting the
previously selected items. You would
have to scan through ALL items do look
for the selected ones (once the user
clicks an item without holding down
the control key)
https://groups.google.com/forum/#!msg/powersoft.public.powerbuilder.objects/B2ulHBrSnrs/itwhNBjlyOoJ
One approach to this is to use the CheckBoxes attribute on the treeview, then check the treeviewitem's StatePicture (Unchecked = 1, Checked = 2).
Good luck,
Terry.