Answered by:
When I use the " WinJS.Binding.oneTime " how to use the converter

Question
-
hi jpsanders~ Do you remember that you answered this question:http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f53f4a19-6a32-41af-8933-2d115f2bcd24? ,about " Binding ListView to collection from C# WinRT component "
But When I use the " WinJS.Binding.oneTime " how to use the converter ?
For example I do something like this:
Thursday, May 10, 2012 8:22 AM
Answers
-
Hi Sith,
I did not find a better way to do this. I think there are three things you can consider...
1. Format the data the way you want to see it in your C# component (perhaps set a property before you retrieve it).
2. Implement the datasource in your C# componenet so that is supports normal binding (IObservable).
3. Create a custom renderer and format your field there.
-Jeff
Jeff Sanders (MSFT)
- Marked as answer by Sith Go Thursday, May 17, 2012 1:50 AM
Monday, May 14, 2012 7:45 PMModerator
All replies
-
Have you tried putting oneTime before textContent?
Jeff Sanders (MSFT)
Thursday, May 10, 2012 7:02 PMModerator -
Have you tried putting oneTime before textContent?
Jeff Sanders (MSFT)
I tried it again ~ But It does not work ~
And WinJS.Binding.oneTime can not be placed before the textContent~
Do you have any other ways ? thanks ~ :)
- Edited by Sith Go Friday, May 11, 2012 9:36 AM
Friday, May 11, 2012 9:32 AM -
Ah, I see the issue... oneTime IS a converter.
You could override the converter in WinJS but let me see if there is a more elegant way to solve this.
-Jeff
Jeff Sanders (MSFT)
Friday, May 11, 2012 1:25 PMModerator -
Hi Sith,
I did not find a better way to do this. I think there are three things you can consider...
1. Format the data the way you want to see it in your C# component (perhaps set a property before you retrieve it).
2. Implement the datasource in your C# componenet so that is supports normal binding (IObservable).
3. Create a custom renderer and format your field there.
-Jeff
Jeff Sanders (MSFT)
- Marked as answer by Sith Go Thursday, May 17, 2012 1:50 AM
Monday, May 14, 2012 7:45 PMModerator -
ok I will try it thanks jpsanders :)Thursday, May 17, 2012 1:50 AM
-
en...but.....
How to use IObservable to Implement the datasource in our C# componenet so that is supports normal binding .
Such as our Data source definition like this :
namespace DataComponent
{
[DataContract]
public sealed class Chapter
{
public Book Parent { get; set; }
[DataMember]
public string ID { get; set; }
[DataMember]
public string IndexTitle { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Version { get; set; }
[DataMember]
public string Icon { get; set; }
[DataMember]
public string CreditPoint { get; set; }
[DataMember]
public string FolderPath { get; set; }
[DataMember]
public IList<Section> Sections { get; set; }
public int SectionsObservable { get; set; }
public Chapter(){
this.Sections = new List<Section>();
}
}
}
Thursday, May 17, 2012 6:25 AM