1

Hi i need to draw an checkbox within the rectangle.is there any predefined method in c# WPF .or how to i acheive this senario in WPF.

SharpGobi
  • 144
  • 1
  • 13

2 Answers2

4

You may try this:

 CheckBox checkbox = new CheckBox();
 checkbox.Content = "Content";
 checkbox.Height = 50;
 checkbox.Width = 100;
 checkbox.IsChecked = true;
 checkbox.HorizontalAlignment = HorizontalAlignment.Left;

 VisualBrush vb = new VisualBrush(checkbox);
 drawingContext.DrawRectangle(vb, null, new Rect(50, 50, 100, 50));
codertuhin
  • 61
  • 5
-1

1.) Create the Rectanle

2.) Create the checkbox

3.) use rectangle.Controls.Add(checkbox)

Hope this helps :)

Johan
  • 262
  • 1
  • 15