wp wp8: custom dll library creation

In view of the project test:

Create a wp8 project Right-click operation under

the solution as shown:









Regenerate to add the dll to the test project


Note : 1. If the project content does not customize the control import header form, such as: xmlns:sam="clr -namespace:MyControl.M"

      2. If you import the control header defined in the dll library, such as: xmlns:AD="clr-namespace:ADLib.AD.controls;assembly=ADLib"

      3. After modifying the library source code, you need to Regenerate, otherwise it will not work in the test project

7. Add resources in the dll library.

  For example, I add an Assets folder in my ADLib library, and add a picture in the folder, the name is default1.png

  . Operation:

Method 1:



Set the image property --- Generate operation = embedded resource Operation



in code:

Assembly asssembly = Assembly.GetExecutingAssembly();

Stream stream = asssembly.GetManifestResourceStream("ADLib.Assets.default1.png");

BitmapImage bitmapImage = new BitmapImage();

bitmapImage.SetSource(stream);

im.Source = bitmapImage;

"Library name.Folder name.Image full name"



Method 2:



Set the image property --- Generate operation = Resource

<Image Source="/ADLib;component/Assets/default1.png" x:Name="im" HorizontalAlignment ="Stretch" VerticalAlignment="Stretch"></Image>

/library name;component/folder name/image full name

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326397897&siteId=291194637
WP2