我知道silverlight已經有了一個子窗口控件,但是我想從我自己的庫中使用這個子窗口控件。Silverlight中的childWindow控件作爲自定義控件
具體我想要的代碼看起來是這樣的: XAML:
<mycontrols:myChildWindow x:Class="SilverlightClassLibrary1.ChildWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mycontrols="clr-namespace:mynamespace;assembly=myassembley"
Width="400" Height="300"
Title="ChildWindow1">
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
</Grid>
和我的項目將引用MyAssembly.dll程序,這將對了myNameSpace在it.And會有類myChildWindow在mynamespace中。此類可以從System.windows.control.childwindow(可能)繼承。
我知道這是一個奇怪的實現方式,但我需要它是這樣的。請告訴我如何實現myChildWindow類?
如果問題不清楚,請提問更多的問題。我可以對問題進行編輯。
您提供的代碼應該沒問題,除了
matt
是的,先生。但我的問題是我將如何實現myChildWindow? –
'公共類myChildWindow:ChildWindow {公共myChildWindow():base(){}}'應該足以工作。 – matt