Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF Converter Set or Library

WPF Converter Set or Library

Scheduled Pinned Locked Moved WPF
csharpdatabasewpfcomquestion
17 Posts 7 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    michaelbarb
    wrote on last edited by
    #1

    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.

    L R Richard DeemingR S 4 Replies Last reply
    0
    • M michaelbarb

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • L Lost User

        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

        M Offline
        M Offline
        michaelbarb
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • M michaelbarb

          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.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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

          M 1 Reply Last reply
          0
          • M michaelbarb

            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.

            R Offline
            R Offline
            RedDk
            wrote on last edited by
            #5

            The official dope: Project converters - Visual Studio (Windows) | Microsoft Docs[^]

            M 1 Reply Last reply
            0
            • R RedDk

              The official dope: Project converters - Visual Studio (Windows) | Microsoft Docs[^]

              M Offline
              M Offline
              michaelbarb
              wrote on last edited by
              #6

              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.

              T 1 Reply Last reply
              0
              • L Lost User

                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

                M Offline
                M Offline
                michaelbarb
                wrote on last edited by
                #7

                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.

                L 1 Reply Last reply
                0
                • M michaelbarb

                  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.

                  T Offline
                  T Offline
                  trønderen
                  wrote on last edited by
                  #8

                  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?

                  M 1 Reply Last reply
                  0
                  • T trønderen

                    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?

                    M Offline
                    M Offline
                    michaelbarb
                    wrote on last edited by
                    #9

                    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.

                    T 1 Reply Last reply
                    0
                    • M michaelbarb

                      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.

                      T Offline
                      T Offline
                      trønderen
                      wrote on last edited by
                      #10

                      OK, I have used and written that kind of converters. I just didn't trigger on the name "binding converter". I though it was some way of converting the binding as such, not the value type!

                      1 Reply Last reply
                      0
                      • M michaelbarb

                        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.

                        Richard DeemingR Offline
                        Richard DeemingR Offline
                        Richard Deeming
                        wrote on last edited by
                        #11

                        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

                        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                        realJSOPR 1 Reply Last reply
                        0
                        • M michaelbarb

                          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.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          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

                          M 1 Reply Last reply
                          0
                          • L Lost User

                            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

                            M Offline
                            M Offline
                            michaelbarb
                            wrote on last edited by
                            #13

                            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.

                            1 Reply Last reply
                            0
                            • Richard DeemingR Richard Deeming

                              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

                              realJSOPR Offline
                              realJSOPR Offline
                              realJSOP
                              wrote on last edited by
                              #14

                              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

                              1 Reply Last reply
                              0
                              • M michaelbarb

                                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.

                                S Offline
                                S Offline
                                Super Lloyd
                                wrote on last edited by
                                #15

                                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!

                                M 1 Reply Last reply
                                0
                                • S Super Lloyd

                                  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!

                                  M Offline
                                  M Offline
                                  michaelbarb
                                  wrote on last edited by
                                  #16

                                  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.

                                  S 1 Reply Last reply
                                  0
                                  • M michaelbarb

                                    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.

                                    S Offline
                                    S Offline
                                    Super Lloyd
                                    wrote on last edited by
                                    #17

                                    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!

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups