Apply ItemTemplate to LongListSelector in code behind - c#-4.0

I've defined a DataTemplate for the items in my LongListSelector in the page resources and now I want to apply this DataTemplate to an LongListSelector in the code behind file. How can I do this?
Thanks.

It is quite simple:
'NameOfList'.ItemTemplate = this.Resources["'NameOfDataTemplate'"] as DataTemplate;

Related

Wrong View shown (Catel)

I'm trying to open a View with a ViewModel from my MainWindowViewModel.
It works, but all I get is a blank window. It binds the correct title but every other control is missing.
Did anyone have the same problem and found a solution?
You forgot the call to InitializeComponent in your code-behind. Just a tip: create a base class with the Catel behaviors, then use that as a base view. It will keep your actual window code-behind much cleaner.

need to embed child fxml inside parent fxml

I am new to JavaFX and I want to know if there is way to place one fxml file as in child.fxml inside another say parent.fxml.
Why do i need this ?
Idea is, i want create independent screens(small one) and write a parent fxml where we can add these child fxml to create a desired GUI, instead of one fxml where i dump all the controls.
If it's possible, please help with some dummy code or links. I have tried looking around for a while but did not get anything useful.
Thanks in advance for any help.
If I understand correctly you want to use "fx:include" tag. Please refer the fxml reference

UICollectionView custom layouts

Hi I am beginning iOS development, and was playing around with UICollectionView. I was just wondering how you could achieve this type of layout. As shown below:
The idea is to have like a main news article in the big cell. Just confused how I am suppose to get two cells in the 2nd column. Much appreciated!
Create custom class which will act as layout for your collection view. This class will child class for UICollectionViewFlowLayout.
Then you can override below two methods and can create your own custom layout as you want.
- (NSArray*)layoutAttributesForElementsInRect:(CGRect)rect
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path
UICollectionViewLayoutAttributes is class which will deal with cell position, frame, Zindex etc
You can also use below properties.
collectionView:layout:minimumInteritemSpacingForSectionAtIndex:
collectionView:layout:minimumLineSpacingForSectionAtIndex:

Create Custom view in Android

I need to create a Custom view in android which will have dynamic text like price, address etc. and also an ImageView inside it as shown in the image below. I tried to find google some tutorial for custom view but didn't find something satisfactory to do all these things. I also need to use onClick event on this view. Please guys, some code would be of great help. I'm a novice to android. I read google tutorial to create custom view but couldn't implement this.
https://lh4.ggpht.com/HmwmRTx3g9ddkHbgvZXpZOB3Am-O9OQARQ2qpxJ16zTDZbG57CmvgxUC75sGFzC3cqrH
Thanks for attention.
This is called Custom Overlay for MapView.
You can check example and implement as per your requirement - Android MapView Balloons
You can use FrameLayouts. It is very simple to use. FrameLayout can add several views on top of each other. It creates a stack of the views. Just add whatever views you want to inside FrameLayout and use the property setVisibility() to control when to show which view.

Dynamic UI ListView

If I have a xml file linear layout with CheckBox, TextView and ImageView and want this to display as scrollable list, having different name and different pictures in every rom of ListView , how can I do it. I am really confused, can you please help me understand. Thank you.
What you're trying to achieve is a custom list row. There are plenty of examples around:
http://appfulcrum.com/?p=311
http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

Resources