KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
On my viewmodel I've got an int property and I want to expose it for editing with a ComboBox, with a limited set of choices, such as 16, 8, 4 and 2. Is there a way to specify the choices in the XAML, while still binding the value back to the viewmodel? I'd want to do something like this: <ComboBox SelectedValue="{Binding MyIntProperty}"> <ComboBoxItem>16</ComboBoxItem> <ComboBoxItem>8</ComboBoxItem> <ComboBoxItem>4</ComboBoxItem> <ComboBoxItem>2</ComboBoxItem> </ComboBox> I know I could rig up a List<int> in code and set that as the ItemsSource, but I'm hoping there's a way to do this that doesn't involve an extra property in the viewmodel that exposes a collection created in code.
Tags (comma-separated)
Save Edits
Cancel