新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
silverlightcontrol創(chuàng)建過程解析
微軟在UI領(lǐng)域中正在逐漸的展現(xiàn)其的作用。silverlight的推出就是一款跨平臺(tái)的多媒體處理工具??梢詭椭绦騿T實(shí)現(xiàn)許多功能。我們?cè)谶@里先來了解一下silverlight control相關(guān)概念。#t#

我們提供的服務(wù)有:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、羅江ssl等。為千余家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的羅江網(wǎng)站制作公司
在做控件的Template的時(shí),有可能需要用到位圖。但是直接把圖片放到silverlight control中去,在編譯運(yùn)行時(shí)會(huì)有xamlprase錯(cuò)誤。 這是控件沒有找到圖片資源報(bào)的錯(cuò)誤。圖片正確的寫法應(yīng)該是這樣:
- < Image Source="/MyControl;
component/nasa.png" />完整的Template
代碼如下:< ResourceDictionary - xmlns="http://schemas.microsoft.
com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.mic
rosoft.com/winfx/2006/xaml" - xmlns:vsm="clr-namespace:System.
Windows;assembly=System.Windows" - xmlns:my="clr-namespace:
MyControl;assembly=MyControl" - >
- < Style TargetType="my:MyQRCode">
- < Style.Setters>
- < Setter Property="Template">
- < Setter.Value>
- < ControlTemplate TargetType=
"my:MyQRCode"> - < Grid x:Name="Root">
- < Image Source="/MyControl;
component/nasa.png" /> - < /Grid>
- < /ControlTemplate>
- < /Setter.Value>
- < /Setter>
- < /Style.Setters>
- < /Style>
- < /ResourceDictionary>控件代碼:
public class MyQRCode : Control - {
- public MyQRCode() : base() {
- DefaultStyleKey = typeof(MyQRCode);
- }
- public override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
- }
- }
上面就是我們?yōu)榇蠹医榻B有關(guān)silverlight control相關(guān)創(chuàng)建方法。
分享名稱:silverlightcontrol創(chuàng)建過程解析
當(dāng)前路徑:http://www.fisionsoft.com.cn/article/dhsdjdp.html


咨詢
建站咨詢
