日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Silverlight引用資源具體方法介紹

Silverlight開發(fā)工具的應用方法是比較簡單的。在實際的開發(fā)程序中,可以幫助開發(fā)人員輕松的實現(xiàn)各種視頻音頻WEB應用程序。在這里我們將會了解到有關Silverlight引用資源的一些相關介紹。#t#

創(chuàng)新互聯(lián)專注于莒南企業(yè)網(wǎng)站建設,響應式網(wǎng)站設計,商城系統(tǒng)網(wǎng)站開發(fā)。莒南網(wǎng)站建設公司,為莒南等地區(qū)提供建站服務。全流程按需網(wǎng)站策劃,專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務

下面討論三種在工程中Silverlight引用資源的方法:資源 Resource、內(nèi)容 content 和 none。

Silverlight引用資源1、默認情況下 mainPage.xaml 的 Build action 是 Page,而加入的資源文件則是 Resource。這樣,我們加入到 應用的根目錄下的圖片可以這樣引用。

  1. < UserControl x:Class="_009_uri.MainPage"
  2. xmlns="http://schemas.microsoft.
    com/winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft.
    com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.
    com/expression/blend/2008" xmlns:mc=
    "http://schemas.openxmlformats.org
    /markup-compatibility/2006" 
  5. mc:Ignorable="d" d:DesignWidth="640" 
    d:DesignHeight="480">
  6. < Grid x:Name="LayoutRoot">
  7. < Image Source="./blend.jpg">< /Image>
  8. < /Grid>
  9. < /UserControl>

編譯后,可以看到圖片。

資源(Resource):這個build action選項會將文件嵌入項目的程序集中。這個選項意味著,如果你添加了一個視頻,那么你生成的xap會比你想象中的要大一些。

Silverlight引用資源2、 按照內(nèi)容的方式進行 build。我們先看一下代碼:

 
 
 
  1. < UserControl x:Class="_009_uri.MainPage"
  2. xmlns="http://schemas.microsoft.com
    /winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft.
    com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com
    /expression/blend/2008" xmlns:mc=
    "http://schemas.openxmlformats.org
    /markup-compatibility/2006" 
  5. mc:Ignorable="d" d:DesignWidth="640"
     d:DesignHeight="480">
  6. < Grid x:Name="LayoutRoot">
  7. < Image Source="./blend.jpg" Width="250"
     Margin="0,0,300,0">< /Image>
  8. < MediaElement Source="./old6.mp4"
     Margin="250,50,0,0" Width="200">
  9. < /MediaElement>
  10. < /Grid>
  11. < /UserControl>

雖然引用的方式?jīng)]有變化,但是此時我們必須將 jpg 和 mp4 文件放到網(wǎng)站的 ClientBin 或者其他和我們的應用同級的目錄中,才能夠正常的訪問,而此時,我們生成的 xap 又變成了一個小巧的文件包。

如果我們不適用相對的路徑,仍然可以用絕對的路徑來訪問我們的應用。

 
 
 
  1. < UserControl x:Class="_009_uri.MainPage"
  2. xmlns="http://schemas.microsoft.com/
    winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft.com
    /winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com
    /expression/blend/2008" xmlns:mc="http
    ://schemas.openxmlformats.org/markup-
    compatibility/2006" 
  5. mc:Ignorable="d" d:DesignWidth="640" 
    d:DesignHeight="480">
  6. < Grid x:Name="LayoutRoot">
  7. < Image Source="./blend.jpg" Width="250"
     Margin="0,0,300,0">< /Image>
  8. < MediaElement Source="http://localhost
    :7323/009_uri.Web/ClientBin/old6.mp4" 
    Margin="250,50,0,0" Width="200">
  9. < /MediaElement>
  10. < /Grid>
  11. < /UserControl>

我認為,這種方法使我們?nèi)粘m椖恐薪?jīng)常用到的。

另外,如果我們使用前導斜杠(/)的相對URI,則表示我們要基于應用程序跟的位置來尋找Silverlight引用資源。

 
 
 
  1. < UserControl x:Class="_009_uri.MainPage"
  2. xmlns="http://schemas.microsoft.com
    /winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft
    .com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.
    com/expression/blend/2008" xmlns:mc=
    "http://schemas.openxmlformats.org
    /markup-compatibility/2006" 
  5. mc:Ignorable="d" d:DesignWidth="640" 
    d:DesignHeight="480">
  6. < Grid x:Name="LayoutRoot">
  7. < Image Source="./blend.jpg" 
    Width="250" Margin="0,0,300,0">< /Image>
  8. < MediaElement Source="/../Assets/
    old6.mp4" Margin="250,50,0,0" 
    Width="200">< /MediaElement>
  9. < /Grid>
  10. < /UserControl>

Silverlight引用資源3、build action 為 none的時候,我們可以按照2的方式來進行引用。


網(wǎng)站標題:Silverlight引用資源具體方法介紹
URL分享:http://www.dlmjj.cn/article/djdocie.html