Creating Silverlight UserControl -


I am creating a Silverlight user control, which I should be able to drag and drop through the mix. But this control must accept the map that is already on the page.

For example

  1. Main. There is a map control in Xml.
  2. MapEditor.xaml contains buttons and other controls in .cs file, it needs access to map control (one of the main XML).

How do I go about doing this?

I was thinking about adding a parameter to the constructor for a constructor, but how do I pass in the map as a parameter in design mode?

Thank you.

ps I am going to break this control into a Silverlight Library so that it can be used later in many projects.

You do not want to give your control a parameterized constructor, using XAML only by using its default constructor Will build type.

Simple approach

The easy way is to add dependency to your control, for which you will provide map control (I type the name in this example < Code> MyMap ): -

  Public Map Map {get {return (MyMap) GetValue (MapProperty); } Set {set value (mapproperty, value); }} Public static dependency mapping MapProperty = new dependency property ("map", typef (mime), typef (mapedit), new propertymataccount (empty));  

Now in Blend the Map property will appear in a variety of categories in the Properties tab.

Hard Core Approach

She said that I After the guidelines, I am willing to make a proper optimization control. With the addition that I can extend the ContentControl base class and include a ContentPresenter in the center of the template. This control will create the assumption that hair control is a MyMap control.

From this perspective, the permission to style the MapEditor control is mixed and it allows the control of the map that is "controlled" so as to control hair control. There is a drop-down on MapEditor .


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -