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

Derived RadTileViewItem Not Displaying Correctly

3 Answers 92 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Tyrin-J
Top achievements
Rank 1
Tyrin-J asked on 08 Dec 2009, 07:23 PM
The RadTileView control is an amazing control with great potential. However, I am unable to get the best out of it; your documentation is scanty.

Our solution requires us using the RadTileViewItem as a container for other controls (with fairly extensive design). This container (RadTileViewItem ) will be instantiated by users when they click a menu item. We thought making this a custom control inheriting from RadTileViewItem would solve the problem. 

Upon instantiating our newly derived control, we noticed that our derived control was hosted in another RadTileView; so it seems. Every time you create a new instance of the derived control, it is hosted inside another RadTileView. Is there anything we are not doing.

Also, we noticed that we cant edit the TextBlock inside the derived control; it behaves as if it is now readonly.

Please, your quick response will be highly appreciated so that we can finish our POC for a client.

Oriaz

3 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 13 Dec 2009, 11:30 AM
Hello Tyrin-J,

The RadTileView control and ItemsControls in general, have an IsItemItsOwnContainerOverride() method which is used for determining whetner an object in the Items collection of the control is a suitable container. If for example you put a list of string objects in a ListBox, each string will be wrapped in a dynamically created ListBoxItem container. The same goes for all ItemsControls, including the TileView and this is the reason why your derived controls are wrapped in TileViewItem containers. If you want to avoid this, you must inherit the TileView control and override its IsItemItsOwnContainerOverride() method. Below is a short example:

public class MyTileView : RadTileView
{
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is MyTileViewItem;
}
}

public class MyTileViewItem : RadTileViewItem
{

}

Let me know if this helps.

Kind regards,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tyrin-J
Top achievements
Rank 1
answered on 13 Dec 2009, 03:33 PM
Hi,

I am still getting the same result. Is there something I am missing?

' Derived tile view

Partial

 

Public Class TileView

 

 

Inherits Telerik.Windows.Controls.RadTileView

 

 

Public Sub New()

 

 

    MyBase.New()

 

        InitializeComponent()

 

    End Sub

 

 

 

 

    Protected

 

Overloads Overrides Function IsItemItsOwnContainerOverride(ByVal item As Object) As Boolean

 

 

        Return (TypeOf item Is overa.instantmessaging.ChatView)

 

 

    End Function

 

 

 

End

 

Class

 



' Derived TileViewItem

Partial

 

Public Class ChatView

 

 

Inherits Telerik.Windows.Controls.RadTileViewItem

 

 

    Public Sub New()

 

        InitializeComponent()

 

    End Sub

 

End

 

Class

 


I also noticed that when the application is loaded, a radtileviewitem is created by default. This is not desirable.

My original question was 2-part. The textblocks in the derived radtileviewitem are locked preventing data input. How can this behaviour be removed.
0
Kiril Stanoev
Telerik team
answered on 16 Dec 2009, 05:22 PM
Hello Tyrin-J,

I have created a sample project that contains an inherited tile view item. The inherited tile view item (MyTileViewItem) gets its style from the themes\generic.xaml. For the sake of the example, I have added a TextBox in the ControlTemplate of MyTileViewItem. Have a look at the sample project and if you find something unclear, let me know.


Best wishes,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TileView
Asked by
Tyrin-J
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Tyrin-J
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or