数据绑定WPF+;铁蟒
我想连接wpfcode和ironpython。但是我不知道怎么用这个 xaml和py文件之间的数据绑定。我该怎么办 XAML:数据绑定WPF+;铁蟒,wpf,binding,ironpython,Wpf,Binding,Ironpython,我想连接wpfcode和ironpython。但是我不知道怎么用这个 xaml和py文件之间的数据绑定。我该怎么办 XAML: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WpfApplication9" Height
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WpfApplication9" Height="300" Width="300">
<Grid>
<TextBlock Text="{Binding Path=time1()}" HorizontalAlignment="Left" Margin="10,117,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="272"/>
</Grid>
</Window>
您应该绑定agains属性:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WpfApplication9" Height="300" Width="300">
<Grid>
<TextBlock Text="{Binding SomeMemer, Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,117,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="272"/>
</Grid>
</Window>
你看过或看过吗?所有这些都提示使用INotifyPropertyChanged。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WpfApplication9" Height="300" Width="300">
<Grid>
<TextBlock Text="{Binding SomeMemer, Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,117,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="272"/>
</Grid>
</Window>
import wpf
import time
from System.Windows import Application, Window
from time import localtime
class MyWindow(Window):
someMember = None
def __init__(self):
wpf.LoadComponent(self, 'test.xaml')
self.someMember = "Hello World"
@property
def SomeMember(self):
return self.someMember
@psetter.SomeMember
def SomeMember(self, value):
self.someMember = value
if __name__ == '__main__':
Application().Run(MyWindow())
time1()