我想使用 IronPython 和 SharpDevelop 4.2 创建一个 WPF 应用程序。但我很困惑如何访问 Window1.xaml 中的对象。
请帮忙.. :)
这是我由 SharpDevelop 4.2 自动创建的代码:
Window1.xaml
<?xml version="1.0" encoding="utf-8"?>
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="wpf01"
Height="300"
Width="300">
<StackPanel
Margin="15"
x:Name="stackPanel">
<Button
FontSize="24"
x:Name="button">
<Button.BitmapEffect>
<DropShadowBitmapEffect />
</Button.BitmapEffect>
Push Me
</Button>
<TextBox
x:Name="txtName"
Width="120"
Height="20"
Text="aaaaa" />
</StackPanel>
</Window>
窗口1.py
import wpf
from System.Windows import Window
class Window1 (Window):
def __init__(self):
wpf.LoadComponent(self, 'Window1.xaml')
应用程序.py
import wpf
from System.Windows import Application
from Window1 import Window1
window = Window1()
app = Application()
app.Run(window)