如何确定silverlight应用程序的主机

时间:2009-05-02 12:55:43

标签: silverlight amazon-s3

我的Silverlight应用程序需要从它的数据来回到主机。如何让webclient连接回该站点的根目录。

例如,我的s​​ilverlight xap位于Amazon S3存储桶中,并通过同一存储桶中的HTML文件加载。我想做一个http://mybucket.s3.amazonaws.com/,然后对从GET返回的xml进行操作。

2 个答案:

答案 0 :(得分:3)

使用System.Windows.Application.Host - 请参阅the documentation,其中包含以下示例:

“以下示例显示如何使用Host获取Silverlight应用程序包的路径。”

<UserControl x:Class="SilverlightApplication.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Grid>
        <TextBlock Text="{Binding Source}" />
    </Grid>

</UserControl>

答案 1 :(得分:1)

C#中的Application.Current.Host.Source