This is a migrated thread and some comments may be shown as answers.

set VisualElement to textblock inside longlistselector

2 Answers 25 Views
LiveTileHelper
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
brandon
Top achievements
Rank 1
brandon asked on 06 May 2014, 04:31 PM
I'm currently using a longlistselector to update a live tile using LiveTileHelper.  but i'm adding a checkbox in my longlistselector and i do not want that showing up on my tile.  i tried referencing the textblock inside the longlist but that's not working.  is it possible to set the VisualElement to a textblock inside  a longlistselector? or do i need to come up with another method?

thanks

2 Answers, 1 is accepted

Sort by
0
brandon
Top achievements
Rank 1
answered on 06 May 2014, 09:01 PM
i ended up using multiple longlistselectors....seems to work fine.
0
Todor
Telerik team
answered on 09 May 2014, 08:20 AM
Hi,

Thank you for your question.

It is possible to get a TextBlock which is part of the LongListSelector by using our ElementTreeHelper. However, since the TextBlock is part of the ItemTemplate of LongListSelector, you have one TextBlock for each item. If I understand correctly, you want to use all TextBlock-s which are inside the LongListSelector for your tile which is not possible. If this is not the case and you want just one specific TextBlock, here's how you can get it:

TextBlock t = ElementTreeHelper.FindVisualDescendant<TextBlock>(lstTask, (descendant) =>
    {
        if (!(descendant is TextBlock))
        {
            return false;
        }
        if(((TextBlock)descendant).Text.StartsWith("1"))
        {
            return false;
        }
        return true;
    });

This call gets the first TextBlock whose Text doesn't start with "1" as an example. If you just need the first TextBlock, you can skip the predicate and use the one parameter overload:

TextBlock t = ElementTreeHelper.FindVisualDescendant<TextBlock>(lstTask)

I hope this information helps.

Regards,
Todor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
LiveTileHelper
Asked by
brandon
Top achievements
Rank 1
Answers by
brandon
Top achievements
Rank 1
Todor
Telerik team
Share this question
or