Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to effectively create this kind of control

$
0
0

The shape of the control always will be a rectangle.

The user must be able to click on it (like a button).

What is different about this control it's the way it is rendered. For example, the control could be any of this images:


I will have to dynamically create this control. In order to construct the layout of the control (which it can differ), it will have a property like this:

public IEnumerable<RectangleInfo> Rectangles{get;set;}

public class RectangleInfo
{
public int X{get;set;}
public int Y{get;set;}
public int Height{get;set;}
public int Width{get;set;}
}

So, any ideas of how to begin constructing this control?

Which class it should inherit from? Control? ContentControl?

I thought each rectangle definition could be a Label (nasty) and then I set the x,y,widht,height of each Label (didn't like that idea)

OBS: It is trickier than it looks, for example, if the user resize the window, this control should resize too (each rectangle should resize accordingly)


Take a look at WPF FlashMessage
About.me




Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>