我有一个我added a codebehind到的资源字典。
在ResourceDictionary中我有一个组合框。我想将该组合框的ItemsSource绑定到代码隐藏中的List。
如何设置我的绑定源以使其在代码隐藏中查找?
This one uses the code behind --------+
|
V
<ComboBox PreviewKeyDown="CustomItem_PreviewKeyDown"
ItemsSource="{Binding AllItems, Source={CodeBehind} />
^ ^
| |
But this one doesn't | because the source is not correct |
如果重要,这就是我的ResourceDictionary的开头:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyProject.MyCodeBehindClass"
x:Name="ANameThatSeemsUselessHere">
关于如何将ItemSource绑定到 ResourceDictionary代码隐藏的任何想法?
答案 0 :(得分:0)
我觉得它有点像 DataContext =“{Static Resource ANameTheSeemsUsl