How to set a binding source to the codebehind of a ResourceDictionary

balaganofff

New Member
I have a ResourceDictionary that I added a codebehind to.In the ResourceDictionary I have a combobox. I want to bind the ItemsSource of that combobox to a List in the codebehind.How can I set the source of my binding so that it looks in the codebehind?\[code\]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 |\[/code\]In case it matters, this is what the start of my ResourceDictionary looks like:\[code\]<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">\[/code\]Any ideas on how I could get the ItemSource binding to the ResourceDictionary codebehind?
 
Back
Top