【发布时间】:2011-04-27 10:47:08
【问题描述】:
有没有办法直接从 xaml 调用外部对象(例如资源对象)的方法?
我的意思是这样的:
<Grid xmlns:dm="clr-namespace:MyNameSpace;assembly=MyAssembly">
<Grid.Resources>
<dm:TimeSource x:Key="timesource1"/>
</Grid.Resources>
<Button Click="timesource_updade">Update time</Button>
</Grid>
timesource_update方法当然是TimeSource对象的方法。
我需要使用纯 XAML,而不是任何代码。
【问题讨论】:
标签: wpf xaml resources methods call