silverlight - WP7 - Databinding + Italics + Wordwrap issue -
here trying do. can't seem able figure out solution yet:
- i have 2 string data sources webservice , on front end want combine them single sentence separated comma.
- the first part want in normal font, second part want in italics
- i want sentence word wrap
- i using mvvm want how bind these string data sources textblock how...
the cases want able handle:
normal:
ex. sentence part 1, this sentence part 2
no second part no comma
ex. sentence part 1 still want able
word wrap
the second part word wraps
ex. sentence part 1, this sentence
part 2 wrapped second line
also
- second part word wrapping
- first part wordwraps followed second part
there seems no easy solution. 1 can think have propertychangedeventhandler notifies me when strings returned webserver, format string in codebehind...
in order achieve effect trying achieve continuous word wrapping italic formatting can sensibly achieved using <run> element within textblock. however, cannot bind contents of run element, need create in code.
assuming 2 separate responses web service (they don't come single call), cannot rely on 1 come in first, use event aggregation notify view view model when necessary data has been received. prism library wp7 includes implementation can use achieve effect (note prism wp7 much lighter it's wpf or silverlight counterparts).
in response event, view can pull properties view model, create textblock , it's component run elements, , update accordingly. in fact, when subscribe event using prism, can specify handler event run on ui thread, no doubt help.
Comments
Post a Comment