Replies: 1 comment
-
DataTemplates are your friend here: https://github.com/AvaloniaUI/Avalonia.Samples#%EF%B8%8F-datatemplate-samples |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to show a canvas based on a dropdown setting. Basically something like this:
<ContentControl Content="{Binding SelectedPanelControl}"></ContentControl>
This works fine. When I do a new select in my dropdown (Combobox) the view will set the SelectedPanelControl. But what Im wonder about is if I can use the value of my Combobox to directly set Content using the Value of my Combobox and a dictionary of possible Controls.
So something like this:
The key in the line
<ContentControl Content="{Binding panelControls[key]}"></ContentControl>
Should be taken from comboBox.Item
Is this possible and if so how? Also, "doing the work" in the xaml or the modelview, which is in general preferred?
Beta Was this translation helpful? Give feedback.
All reactions