-
Notifications
You must be signed in to change notification settings - Fork 393
Getting abbreviation list of a quantity #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't fully understand your example, but here are some pointers that may help you out: Example converter app: Pull request on XAML binding to units using value converter with some reflection code (PR discusses possibility of avoiding the reflection code): If you are able to achieve what you want with C#, then you should be able to do the same with XAML by using a view model property that calculates the combobox list content in C# and binding the XAML to it. I personally prefer this approach over complicated/specialized value converters. Does this help? |
I am able to get abbreviation list in xaml but I need to create a converter class for each unit. Because there isn't any base class for units. |
Right, if I understand it correctly the only approach right now is reflection if you truly must work with the quantities in a generic manner and cannot do things like:
It's not elegant, but it works if you have a small set of quantities you expect to be used and is safer than reflection. #353 discusses a reflection approach. I have created an issue to try to come up with a design proposal for a base type that will help things like your example and the #353 example. Please contribute to #371 to help move this forward. |
Closing this in favor of #371. Help move that forward instead. |
I am trying to bind abbreviation list of quatities to
combobox
itemsource
property. But I am not able to do it. Because I couldn't findabbreviations
property . In c# code I solved this problem with usingLINQ
. But now I need abbreviation list in xaml. So I can't useLINQ
to get abbreviations from units. There is a way to achive this problem. Using converter class to convert units to abbreviations. But I need a base class otherwise I need to create a converter class for each unit. So these are the only ways that I could find.What do you think about base class or abbreviation list?
Or do you have any other solution to get abbreviation list of quatities ?
The text was updated successfully, but these errors were encountered: