Images from binding not re-appearing properly with ListView scrolling - xamarin.forms

I have a ListView with an ItemsSource that is a List. The viewcell binds some String properties from MyDataModel to labels as well as an ImageSource property to an Image.
The idea is they click the button, select an image from gallery, and the image in the viewcell changes to what they selected.
That all works fine, until they scroll. When the images go off screen, and you scroll back up to them then all of the images show the same image (the last one selected, or rather the first one that appears when scrolling back up).
I realize that it's unloading the image and re-loading it.. but why isn't it getting it from the correct binding source?

Not sure, if I understand your question correct (without code)...
But if you have a ListView bound to a List with a custom ViewCell and want to change some showed data, the following should work:
- first change the data in the list
- then reassign the ViewCell:
lvXX.ItemTemplate = new DataTemplate(typeof(XXyourViewCellxx));

Related

Open Additional Fragment

Is there a way to open a second Fragment Page? (ie. open multiple fragment pages at the same time)
I have a database setup and when users click a button a Fragment Page pops up so they can edit the fields. I would like to try and have a sub-menu appear for comments (so they don't have to scroll all the way to the bottom of the screen).
Something like the Menu in the Material Gallery Sample would be great.
Note:
I am currently using app.showDialog(app.pageFragments.Menu); to open the Page Fragments.
Having both Fragments open side by side would be a usable options as well.
Thanks!
Here is an example diagram.
Sorry for the late reply. I'll put this as an answer because I think it will get you what you need. You could implement this if you put the page fragments directly into your page, and toggled their visible property to show/hide them.
The biggest trick here is how does the first page fragment tell the second to open? That ends up being simple, just add a custom boolean property to the first fragment. Then in the base page (which contains the two fragments) bind the visible property of the second fragment to the custom property of the first fragment. Then in the first fragment, you can set that property to "true" when you want the second fragment to show, and "false" when you want it to hide.

Combobox's list not in proper position

I am using spark's combobox as Itemeditor in advance datagrid.
It is working properly but fails to open properly when the Combobox is opened near the bottom of the Flex Object.
It tends to open upwards for the first time (which is perfectly fine) but when I type alphabets to search, it filteres the records and adjust the height of the list properly but could not make to manage the Y cordinate so as to keep the list adjacent to its textbox.
Attaching the two snap shot. Please suggest any solution to fix this.
Thanks

Flex 4.6 Mobile - how to know which itemrenderer is visible

I have a sparks List with the following attributes:
verticalScrollPolicy="off"
horizontalScrollPolicy="on"
pageScrollingEnabled="true"
scrollSnappingMode="leadingEdge"
and inside is an ItemRenderer that takes up a full screen for each item. So basically it is a horizontal list that lets you swipe left and right one page at a time. Note the scrollSnappingMode is on, so the pages always snap perfectly on the page.
Also, I am setting "useVirtualLayout=true" on the Layout, so I have virtual ItemRenderers that are getting recycled.
My question is this: how do I know which ItemRenderer is currently on the screen? Is there an event or property to watch that lets me know when this page has snapped into view and is the currently visible page?
how do I know which ItemRenderer is currently on the screen?
In the situation you describe, which uses Virtual Layouts and only one element displayed on screen at a time; there will only be a single itemRenderer.
You can access the dataProvider element of the itemRenderer using the data property on your itemRenderer.
You can find the index of your data in the dataProvider using the itemIndex property on the itemRenderer.
If you want to know when the list changes from the component that contains the list; you may try listening to the change event; but I'm not sure if that will give you want you need; as it is possible to scroll without selecting a new item.

How to change datagrid cell's itemRenderer dynamically

i have a simple datagrid having 2 columns named as image and place. where image column has mx.controls.Image itemRenderer and place is simple. my requirement is to change itemRenderer of image cell when it will be clicked. i means to say when user click on any image from image column than i want to show that image path in editable mode and when user edit that path then the selected cell will start displayed the updated image.
i dont know how to do this and getting depressed . please anyone help me ! :(
You don't need to change itemRenderer for that - just implement that code in your single item renderer. You can add listeners inside it and change the contents of the current cell.
I suggest when going into editable mode for your DataGrid: Also create an itemEditor for your Image column, make it an extended TextInput class. This extended TextInput class will change the data object's imageAddress/url when you are done editing ("itemEditEnd" event).
Let me know if this helps, thanks!

How to populate long text in dropdownlist in asp.net

In asp.net, am trying to populate a dropdownlist box with very long text. I have fixed the width of list on the page and i don't want to change its size as it would affect my page layout. On clicking the dropdownlist, the text gets truncated to the size of the dropdown. I want to see the entire text without any truncation, without changing the size of the dropdownlist box..Also if there are any third party controls which would solve this problem?Would be very helpful if there's a solution for this.
Update:
Right now am trying a dropdown box in Jquery that will wrap the text if it exceeds the size..but again the problem is it works fine on an independent solution but when i integrate it with my application, it does not read the .css file and it does not do any formatting(style, font, alignment) that it is supposed to do according to the .css file.Any idea why this is happening?
The problem that you're describing is restricted to IE (it might be fixed in the latest version, I haven't tested).
In the past, I've had success with binding javascript methods to the onClick event on the drop down to increase the width, and the onBlur event to set the width back to its original value.
You might be able to use jQuery to create a tooltip like thing that appears when you hover over each option.
something like
// this executes on page load - just like asp.net Page_load()
function pageLoad(){
// attach a mouseover event to each option in your dropdown
$("#myDropdown option").mouseover(function(){
// get the text from that option
var text = $("#"+this.id).text();
// display that text in a small tooltip
showToolTip(text);
});
}
function showToolTip(text){
// display in some way
}
there's a javascript library called wz_tooltip available at walterzorn.com
hope that helps

Resources