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. Disable ComboBox Hyperlinks

Disable ComboBox Hyperlinks

Scheduled Pinned Locked Moved WPF
helpcsswpftutorialquestion
4 Posts 3 Posters 0 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML

    If it's not broken, fix

    Richard DeemingR M 2 Replies Last reply
    0
    • K Kevin Marois

      Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML

      If it's not broken, fix

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

      What's wrong with binding the IsEnabled property on the Hyperlink to a property on your view-model?


      "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

      K 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        What's wrong with binding the IsEnabled property on the Hyperlink to a property on your view-model?


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

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        It would need to be bound to a property on the entity - except there is no entity. I'm loading the combo box with enums.

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        1 Reply Last reply
        0
        • K Kevin Marois

          Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML

          If it's not broken, fix

          M Offline
          M Offline
          Matt T Heffron
          wrote on last edited by
          #4

          Use a DataTemplateSelector as the ComboBox.ItemTemplateSelector. The SelectTemplate() method will be passed each item, (the enum in your case). Select a data template specific to each case you want.

          "Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed." - G.K. Chesterton

          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