C
C#15mo ago
Aurumaker72

❔ Avalonia ComboBox SelectedValuePath

<ComboBox SelectedValue="{Binding Path=SomeValue, Mode=TwoWay}" SelectedValuePath="Tag">
<ComboBoxItem Tag="x">A</ComboBoxItem>
<ComboBoxItem Tag="y">B</ComboBoxItem>
</ComboBox>
<ComboBox SelectedValue="{Binding Path=SomeValue, Mode=TwoWay}" SelectedValuePath="Tag">
<ComboBoxItem Tag="x">A</ComboBoxItem>
<ComboBoxItem Tag="y">B</ComboBoxItem>
</ComboBox>
Is there a way to do this in Avalonia?
4 Replies
Aurumaker72
Aurumaker7215mo ago
<ComboBox SelectedValue="{Binding Theme, Mode=TwoWay}">
<ComboBox.Items>
<x:String>Light</x:String>
<x:String>Dark</x:String>
</ComboBox.Items>
</ComboBox>
<ComboBox SelectedValue="{Binding Theme, Mode=TwoWay}">
<ComboBox.Items>
<x:String>Light</x:String>
<x:String>Dark</x:String>
</ComboBox.Items>
</ComboBox>
I came up with this, but it's not localizable In WPF, you'd just do the following:
<ComboBox SelectedValue="{Binding Path=Theme, Mode=TwoWay}" SelectedValuePath="Tag">
<ComboBoxItem Tag="Light" Content="{LocalizedBinding Light}" />
<ComboBoxItem Tag="Dark" Content="{LocalizedBinding Dark}" />
</ComboBox>
<ComboBox SelectedValue="{Binding Path=Theme, Mode=TwoWay}" SelectedValuePath="Tag">
<ComboBoxItem Tag="Light" Content="{LocalizedBinding Light}" />
<ComboBoxItem Tag="Dark" Content="{LocalizedBinding Dark}" />
</ComboBox>
Honza K.
Honza K.15mo ago
I've used a DynamicResource with resource dictionaries for each locale, so it can be changed in runtime without the need of restarting the app or you can you this https://dev.to/ingvarx/localization-in-avaloniaui-2mdm (https://github.com/IngvarX/Camelot/blob/master/src/Camelot/Services/Implementations/LanguageManager.cs)
DEV Community
Localization in AvaloniaUI
Hey there! This time I gonna explain how to add localization support in your AvaloniaUI app. As...
GitHub
Camelot/LanguageManager.cs at master · IngvarX/Camelot
Camelot is cross-platform file manager written in C# - Camelot/LanguageManager.cs at master · IngvarX/Camelot
Aurumaker72
Aurumaker7215mo ago
Thank you, but that's not what I'm looking for I already implemented a working localization system, the issue is as described in the thread title.
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
✅ ef core can't translate a queryquery: ```cs var username = "some username"; var user = await _db.Users .FirstOrDefault❔ Is the functionality of my code in the right placeI created a valueobject for my sitemap. I'm wondering if it's in the right place or shouldn't it be ❔ Microsoft SQL Server Management Studio ("authority that is not trusted")I'm trying to connect my local server from SSMS but there's an error after I connect.❔ ✅ Trying to understand HID device response dataI have a wireless mouse that I'm trying to make my own software for. So far, it has been quite straiIssue with FolderBrowserDialog in console applicationHey, when I start my application via Visual Studio everything works, but as soon as I start the cons❔ How to restart a BackgroundServiceSearching the internets, I seem to be finding answers that don't really seem right, and not good eve❔ Whats the difference between classes and public classes?Tried looking at Microsoft docs earlier but the don't really answer the question. I already know wh❔ Questions on validating columns and types (updating a single column in a table via REST API)I'm new to .NET and C#. I'm trying to implement a somewhat more difficult endpoint where the user pr❔ Trying to save location data using JSON. Need help!I am very new to coding, and I need to make 3 different scripts (or one script with all 3 functions)❔ Advice on Data modeling-ef coreBasically I've got a lesson which is an aggregate root, On said lesson i got phases and each phase h