How to clip content

3 posts, 0 answers
  1. Karl Mikesell
    Karl Mikesell avatar
    55 posts
    Member since:
    May 2010

    Posted 26 Jul 2010 Link to this post

    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. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 28 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Karl Mikesell
    Karl Mikesell avatar
    55 posts
    Member since:
    May 2010

    Posted 28 Jul 2010 Link to this post

    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
Back to Top