目前,我可以添加资源控制类似下面的内容控制:如何将资源添加到与XAML,类似于ctrl.Resources.Add()
Button b = new Button();
b.Resources.Add("item", currentItem);
我想要做的这与XAML。我试过类似
<Button Content="Timers Overview" Name="btnTimerOverview">
<Button.Resources>
<ResourceDictionary>
<!-- not sure what to add here, or if this is even correct -->
<!-- I'd like to add something like a <string, string> mapping -->
<!-- like name="items" value="I am the current item." -->
</ResourceDictionary>
</Button.Resources>
</Button>
但我没有得到任何进一步的比这。有没有办法在XAML中做到这一点?
什么是你想用资源来实现呢? – 2012-07-12 11:23:39
基本上我试图将一个值与可以映射到系统外部的另一个配置文件的控件相关联。当控件加载时,我可以读取作为资源存储的该值,并根据该值从外部配置中获取配置。 – binncheol 2012-07-12 11:25:38