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

How to clip content

2 Answers 67 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Karl Mikesell
Top achievements
Rank 1
Karl Mikesell asked on 26 Jul 2010, 10:09 PM
Loading a user control into the Large Content container in the RadTileView; however, the user control displays everything and does not get clipped.  How can the content be clipped programmatically to fit into the Large Content container?

Any ideas would be most helpful

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 28 Jul 2010, 07:38 AM
Hello Karl Mikesell,

You can use the Clip property of the UserControl class. Also you can handle the SizeChanged() event in order to determine the dimensions at runtime:

private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
     RectangleGeometry rg = new RectangleGeometry();
     Rect r = new Rect();
     r.Height = 200;
     r.Width = 600;
     rg.Rect = r;
     (sender as UserControl).Clip = rg;
}
Also, it would be best to use fixed or maximum width and height.

Give this approach a try and let us know if it works for you.

Greetings,
Hristo Milyakov,
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Karl Mikesell
Top achievements
Rank 1
answered on 28 Jul 2010, 03:56 PM
Thank you,

Because the User Control is used outside the TileView, we changed the Rectangle size as follows.

Size currentSize = e.NewSize;
Rect r = new Rect(0,0,currentSize.Width,currentSize.Height);

This is a exact size of the TileView container, and also works when used without placement inside the TileView.

Thought you like to know
Tags
TileView
Asked by
Karl Mikesell
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Karl Mikesell
Top achievements
Rank 1
Share this question
or