This is a migrated thread and some comments may be shown as answers.
Get item controls from tileview content
5 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
Kamal Mostofi
Top achievements
Rank 1
Kamal Mostofi asked on 26 Jul 2011, 08:50 PM
Hi,
I designed a form in a tileview content item which customers can send emails to the head office. How can I get the items within the content of tileview? I mean get a textbox value!

Thanks,
Kamal

5 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 27 Jul 2011, 02:25 PM
Hello Kamal,

Could you please tell us how have defined your RadTileView and RadTileViewItems - in XAML or via code (ex. binding)?

Greetings,
Kiril Stanoev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Kamal Mostofi
Top achievements
Rank 1
answered on 30 Jul 2011, 09:26 AM
Hi,
I defined them in Xaml. 

Thanks,
Kamal
0
Tina Stancheva
Telerik team
answered on 03 Aug 2011, 02:20 PM
Hi Kamal,

In this case you can set an x:Name/Name property for each element that you need to access. Setting these properties in XAML identifies the elements in a XAML name-scope. For example if you have the following RadTileView definition:
<telerik:RadTileView x:Name="tileView">
    <telerik:RadTileViewItem Header="Tile 1">
        <StackPanel>
            <TextBlock x:Name="textBl1" Text="TextBlock1" />
        </StackPanel>
    </telerik:RadTileViewItem>
    <telerik:RadTileViewItem Header="Tile 2" Content="Content of Tile 2"/>
</telerik:RadTileView>
You can access the RadTileViewItem "Tile 1" TextBlock in code-behind through its x:Name property:
textBl1.Text = "Test";

Another approach that you can use is to access the TextBlock through the RadTileViewItem.Content property. It holds the content of the tile. This means that the "Tile 1" RadTileViewItem.Content will be an object of type StackPanel. While the "Tile 2" RadTileViewItem.Content will be a string - "Content of Tile 2". This is why you can access the RadTileViewItem "Tile 1" TextBlock in code behind like so:
RadTileViewItem tile1 = tileView.Items[0] as RadTileViewItem;
TextBlock txt1 = (tile1.Content as StackPanel).Children[0] as TextBlock;
txt1.Text = "Test";

I hope this information will help you. Let us know if we can further assist you.

Greetings,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
João
Top achievements
Rank 1
answered on 05 Jan 2016, 01:45 PM

Hi Tina and Kiril,

what if I defined my RadTileView and RadTileViewItems via binding?

 

Greetings, João

 
 
0
Milena
Telerik team
answered on 08 Jan 2016, 11:36 AM
Hi  João,

You can use the second approach Tina suggested, but when you get the TileViewItem you should cast is to your business class instead of RadTileViewItem: 
var tile1 = xTileView.Items[0] as CustomerAccount;
 
where CustomerAccount is a class from the ViewModel and then you can work with its properties (e.g. email address, name, etc.).

I hope this information helps.

Regards,
Milena
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Kamal Mostofi
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Kamal Mostofi
Top achievements
Rank 1
Tina Stancheva
Telerik team
João
Top achievements
Rank 1
Milena
Telerik team
Share this question
or