[Back]
Page.xaml:
<UserControl x:Class="SilverlightDesktopTest.Page" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300" xmlns:SilverlightDesktopTest="clr-namespace:SilverlightDesktopTest" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Canvas x:Name="LayoutRoot" Background="White"> <SilverlightDesktopTest:SilverlightWindowControl WindowPicture="picture2.jpg" Canvas.Left="100" Canvas.Top="10"/> </Canvas> </UserControl>
using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace SilverlightDesktopTest { public partial class Page : UserControl { public Page() { InitializeComponent(); SilverlightWindowControl objSilverlightWindowControl = new SilverlightWindowControl(); objSilverlightWindowControl.WindowPicture = "picture1.jpg"; Canvas.SetLeft(objSilverlightWindowControl, (double)200); Canvas.SetTop(objSilverlightWindowControl, (double)200); this.LayoutRoot.Children.Add(objSilverlightWindowControl); } } }