Monday, February 7, 2011

Trimmed TextBlock for Windows Phone 7.

Unfortunately WP7 is based on Silverlight 3. So we can't use some nice features of Silverlight 4 i.e. dynamic key word or TextBlock's trimming. But I've solved issue with trimming for Silverlight 3. Solution is here. Let me explain which code I use in WP7 project:
  • Generic.xaml: File contains style and template for custom control. This file is located in Themes folder. WP7 tools doesn't contains Resources.xaml file template. So I created xml file and name it as "Generic.xaml".
  • TrimmedTextBlock.cs: It is implementation of custom control. I just copied this file. One more note: I decrement c_POINTS_COUNT to "1" because screen resolution of desktop and mobile versions are different.
Easy coding.

2 comments:

Mike Niller said...

Hello,

i want to say thank you for a great job you've done on your blog.
I have a software download website and I also write articles for people to help them with their computers and software. Is it possible to place this article on your blog as a guest post?

Regards,
Andy G.

RredCat said...

Hi Mike,
Unfortunately I don't post an article about soft. I write about programer's things only.