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

Light Visual Element

2 Answers 330 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Filipe
Top achievements
Rank 1
Filipe asked on 13 Jul 2010, 11:02 AM
Hi,

I want to put LightVisualElement object within a radpanel or something like that, because i want to create tags like Gmail ( http://blogs.telerik.com/WinFormsTeam/Posts/09-12-15/gmail-like_labels_in_radgridview_for_winforms_no_problems.aspx ) and put them into a panel.

The telerik example link shows how to put that LightVisualElements within a custom cell in radgrid, but i need to put LightVisualElement within other controls like radpanel.

2 Answers, 1 is accepted

Sort by
0
Filipe
Top achievements
Rank 1
answered on 13 Jul 2010, 04:16 PM
Hi,

I figure it out how to do add lightvisualelement to radpanel: <radpanel.PanelElement.Children.Add(LightVisualElement)>

Now i have another problem: when i put LightVisualElement inside a radpanel, the element fills all the size of radpanel and i want to give the element only the text size like this function do in Telerik HelpDesk demo:

protected override SizeF ArrangeOverride(SizeF finalSize) 
    float x = 0; 
    foreach (RadElement element in this.Children) 
    
        float y = (finalSize.Height - element.DesiredSize.Height) / 2; 
        float width = element.DesiredSize.Width; 
        if (element != textElement) 
        
            width += 10; 
        
        element.Arrange(new RectangleF(x, y, width, element.DesiredSize.Height)); 
        x += element.DesiredSize.Width; 
        if (element != textElement) 
        
            x += 2; 
        
    
  
    return finalSize; 
}

Can you help me.


0
Nikolay
Telerik team
answered on 19 Jul 2010, 12:40 PM
Hello Filipe,

The simplest way to autosize a LightVisualElement according to its content is to set the StretchHorizontally and StretchVertically properties to false:
visual.StretchHorizontally = false;
visual.StretchVertically = false;

In case of more complex scenarios, you should create a custom layout. The ArrangeOverride method of the Telerik Presentation Framework is similar to the ArrangeOverride method of WPF. For additional information about WPF ArrangeOverride, please refer to the following article:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.arrangeoverride.aspx

As to the TPF ArrangeOverride, please refer to this article.

I hope this helps.

All the best,
Nikolay
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
Tags
General Discussions
Asked by
Filipe
Top achievements
Rank 1
Answers by
Filipe
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or