Hi Gaurav,
Thank you for writing.
Here is an example of using RadPopupControl - feel free to use it as a reference:
public partial class Form1 : ShapedForm |
{ |
MyPopup radPopupControl1; |
|
public Form1() |
{ |
InitializeComponent(); |
|
radPopupControl1 = new MyPopup(); |
} |
|
private void radButton1_Click(object sender, EventArgs e) |
{ |
if (radPopupControl1.IsVisible) |
{ |
radPopupControl1.Hide(); |
} |
else |
{ |
Point point = PointToScreen(this.radButton1.Location); |
point = new Point(point.X, point.Y + this.radButton1.Height); |
SetUpPopup(point); |
radPopupControl1.Show(); |
} |
|
} |
|
private void SetUpPopup(Point location) |
{ |
this.radPopupControl1.Size = new Size(100, 100); |
this.radPopupControl1.BackColor = SystemColors.AppWorkspace; |
this.radPopupControl1.Location = location; |
this.radPopupControl1.PopupText = "Hello world"; |
} |
|
} |
|
public class MyPopup : RadPopupControl |
{ |
LightVisualElement element; |
|
public MyPopup() |
{ |
this.UseNewLayoutSystem = true; |
} |
|
public string PopupText |
{ |
get |
{ |
EnsureChildItems(); |
return this.element.Text; |
} |
set |
{ |
EnsureChildItems(); |
this.element.Text = value; |
} |
} |
|
protected override void CreateChildItems(RadElement parent) |
{ |
this.element = new LightVisualElement(); |
this.element.DrawFill = true; |
this.element.DrawBorder = true; |
this.element.BackColor = Color.Red; |
this.element.ForeColor = Color.Yellow; |
this.element.GradientStyle = GradientStyles.Solid; |
parent.Children.Add(this.element); |
} |
} |
I hope this was helpful. If you have additional questions, do not hesitate to contact me again.
Greetings,
Martin Vasilev
the Telerik team