WPF Converter Set or Library
-
Where can I find an up-to-date library or set of wpf converters? I have also found that System.Windows.Controls contains 3 convertors. The closest I can find to a set. I did a query wpf converters github - Google Search[^] It found several candidates but they are quite dated.
So many years of programming I have forgotten more languages than I know.
-
Where can I find an up-to-date library or set of wpf converters? I have also found that System.Windows.Controls contains 3 convertors. The closest I can find to a set. I did a query wpf converters github - Google Search[^] It found several candidates but they are quite dated.
So many years of programming I have forgotten more languages than I know.
In over 10 years, I have yet the use a "converter"; unless it was my own code in a setter / getter. Your question make it sound like a necessity.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
In over 10 years, I have yet the use a "converter"; unless it was my own code in a setter / getter. Your question make it sound like a necessity.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
It is a feature of binding. I know some people have never used binding. I use it but would not recommend it for the faint of heart. When you have a good set of converters, binding is much more useful. Still very difficult to debug. Do you know about Behaviors? Another obscure and little used feature.
So many years of programming I have forgotten more languages than I know.
-
It is a feature of binding. I know some people have never used binding. I use it but would not recommend it for the faint of heart. When you have a good set of converters, binding is much more useful. Still very difficult to debug. Do you know about Behaviors? Another obscure and little used feature.
So many years of programming I have forgotten more languages than I know.
When I first learned PL/I, I made it my mission to use every possible language feature and function; whether it needed it or not. My apps "bind" and they animate all the time; all without "convertors" and "behaviors". I just work closer to the metal. I would suggest looking at the Community Toolkits for WPF / UWP though.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Where can I find an up-to-date library or set of wpf converters? I have also found that System.Windows.Controls contains 3 convertors. The closest I can find to a set. I did a query wpf converters github - Google Search[^] It found several candidates but they are quite dated.
So many years of programming I have forgotten more languages than I know.
-
The official dope: Project converters - Visual Studio (Windows) | Microsoft Docs[^]
A different kind of converter. This is about the old Converter dialog box. Not the binding converters.
So many years of programming I have forgotten more languages than I know.
-
When I first learned PL/I, I made it my mission to use every possible language feature and function; whether it needed it or not. My apps "bind" and they animate all the time; all without "convertors" and "behaviors". I just work closer to the metal. I would suggest looking at the Community Toolkits for WPF / UWP though.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
If you want to be close to the metal then you would do everything in assembly. When the IBM PC first came out there was quite a discussion about the pros and cons of using assembly. Out of this the one thing I remember was the story about the cowboy that liked to chew on metal nails. Do you remember it? Someone asked a cowboy why he like to chew on nails. He answered, when I look in a mirror and see all my broken and cracked teeth, I look tough. When it pokes me and cuts me in the mouth, the pain makes me feel tough. When there is blood running down the corner of my mouth others will know I am tough.
So many years of programming I have forgotten more languages than I know.
-
A different kind of converter. This is about the old Converter dialog box. Not the binding converters.
So many years of programming I have forgotten more languages than I know.
-
So I must reveal my ignorance ... :-) I never learned about "binding converters". How does a "binding converter" work? What does it do? How do you use it?
This is a very glossy overview I assume you know what binding is since you are watching this forum on WPF. Let’s say you want to bind a bool to visibility. Bool has only 2 states, true and false. Visibility has 3 states, Visible, Hidden, and Collapsed. (Ignoring null). A binding converter will convert bool to visibility. As stated, before binding and converters are not for the faint of heart. This link will get you started, barely. Value conversion with IValueConverter - The complete WPF tutorial[^]
So many years of programming I have forgotten more languages than I know.
-
This is a very glossy overview I assume you know what binding is since you are watching this forum on WPF. Let’s say you want to bind a bool to visibility. Bool has only 2 states, true and false. Visibility has 3 states, Visible, Hidden, and Collapsed. (Ignoring null). A binding converter will convert bool to visibility. As stated, before binding and converters are not for the faint of heart. This link will get you started, barely. Value conversion with IValueConverter - The complete WPF tutorial[^]
So many years of programming I have forgotten more languages than I know.
-
Where can I find an up-to-date library or set of wpf converters? I have also found that System.Windows.Controls contains 3 convertors. The closest I can find to a set. I did a query wpf converters github - Google Search[^] It found several candidates but they are quite dated.
So many years of programming I have forgotten more languages than I know.
michaelbarb wrote:
they are quite dated
Really? The first result[^] was updated two years ago. WPF hasn't changed that much since 2006. :)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
If you want to be close to the metal then you would do everything in assembly. When the IBM PC first came out there was quite a discussion about the pros and cons of using assembly. Out of this the one thing I remember was the story about the cowboy that liked to chew on metal nails. Do you remember it? Someone asked a cowboy why he like to chew on nails. He answered, when I look in a mirror and see all my broken and cracked teeth, I look tough. When it pokes me and cuts me in the mouth, the pain makes me feel tough. When there is blood running down the corner of my mouth others will know I am tough.
So many years of programming I have forgotten more languages than I know.
Converters and behaviors are another layer of indirection; they don't make life easier.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Converters and behaviors are another layer of indirection; they don't make life easier.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
I sometimes think binding is a new form of spaghetti code. Converters are kind of like the meatballs. All covered in sauce, a kind of slippery connection. Binding and converters are a great idea but are almost rendered useless by the lack of debugging tools.
So many years of programming I have forgotten more languages than I know.
-
michaelbarb wrote:
they are quite dated
Really? The first result[^] was updated two years ago. WPF hasn't changed that much since 2006. :)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I've always written my own converters. I have about a dozen or so. I have a bool-to-visibility converter that can be configured (in XAML) to set the visibility to any of the three possible values according to the bool value (just as an for instance).
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
Where can I find an up-to-date library or set of wpf converters? I have also found that System.Windows.Controls contains 3 convertors. The closest I can find to a set. I did a query wpf converters github - Google Search[^] It found several candidates but they are quite dated.
So many years of programming I have forgotten more languages than I know.
What do you want to convert? I rarely have to convert (some yet unidentified) BCL class to other BCL class. Usually I need to convert a business class (i.e. local to your code) to perhaps a BCL class (such as color, image source, etc).. You need to write your own converter there (come on, it's only 2 methods to implement, or just 1 in case of one way binding). Also, if you make some view model, view model can directly expose a property of the right type and have value conversion happening in the property setter.
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
What do you want to convert? I rarely have to convert (some yet unidentified) BCL class to other BCL class. Usually I need to convert a business class (i.e. local to your code) to perhaps a BCL class (such as color, image source, etc).. You need to write your own converter there (come on, it's only 2 methods to implement, or just 1 in case of one way binding). Also, if you make some view model, view model can directly expose a property of the right type and have value conversion happening in the property setter.
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
I recently did an app and the company library had a set of about 30 converters in it. Mostly common things. I found myself using binding and converters much more than I ever had in the past. Simply because I did not have write the converters. They are not hard to write, it is just I am lazy. It got me wondering if out there somewhere there is a better worked out converter library????
So many years of programming I have forgotten more languages than I know.
-
I recently did an app and the company library had a set of about 30 converters in it. Mostly common things. I found myself using binding and converters much more than I ever had in the past. Simply because I did not have write the converters. They are not hard to write, it is just I am lazy. It got me wondering if out there somewhere there is a better worked out converter library????
So many years of programming I have forgotten more languages than I know.
forget it... converter are the simplest thing to write. if you feel the need to download premade one, you need more practice writing ones! ;P also, most of them, apart perhaps from the classical boolean to visibility, null to boolean, and null to visibility and color to brushes and pens, are specific to your application
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!