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. C#
  4. ListView item highlighting

ListView item highlighting

Scheduled Pinned Locked Moved C#
tutorial
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.
  • C Offline
    C Offline
    Cyrilix
    wrote on last edited by
    #1

    I'm curious as to whether or not I'd be able to do the following things to list view items: #1 - Make it so that even when the list view does not have focus, a selected item shows up with the dark blue background color. If you set ListView.HideSelection = false, a selected item without focus will have a grey background, which unfortunately, I haven't been able to figure out how to change. #2 - Allow selected ListView items to fully select the row. This is not ListView.FullRowSelect, but rather what I mean is... say I have the item "Item1" in the ListView, yet the ListView is wider than that text, the highlighted portion will only cover that text, but will not cover the entire row. Thanks.

    W M 2 Replies Last reply
    0
    • C Cyrilix

      I'm curious as to whether or not I'd be able to do the following things to list view items: #1 - Make it so that even when the list view does not have focus, a selected item shows up with the dark blue background color. If you set ListView.HideSelection = false, a selected item without focus will have a grey background, which unfortunately, I haven't been able to figure out how to change. #2 - Allow selected ListView items to fully select the row. This is not ListView.FullRowSelect, but rather what I mean is... say I have the item "Item1" in the ListView, yet the ListView is wider than that text, the highlighted portion will only cover that text, but will not cover the entire row. Thanks.

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      For the first question: Not sure but I think owner drawn items could be the answer. For the second: If your column(s) is as wide as the listview, the full row should be selected so setting column width helps here. Hope this helps, Mika

      1 Reply Last reply
      0
      • C Cyrilix

        I'm curious as to whether or not I'd be able to do the following things to list view items: #1 - Make it so that even when the list view does not have focus, a selected item shows up with the dark blue background color. If you set ListView.HideSelection = false, a selected item without focus will have a grey background, which unfortunately, I haven't been able to figure out how to change. #2 - Allow selected ListView items to fully select the row. This is not ListView.FullRowSelect, but rather what I mean is... say I have the item "Item1" in the ListView, yet the ListView is wider than that text, the highlighted portion will only cover that text, but will not cover the entire row. Thanks.

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Ok here you are going outside the design limitations of the control you are using. You have 2 basic choices, find an alternative control that meets your requirements (Infragistics and DevExpress are 2 suppliers) or create your own control. 1. The background colour of the selected item is probably managed by the skin/style windows is using. 2. You are asking it to paint the listviews backgound area according to a control (item) that is not there. As Eric said expand the last subitem to the full width, except then you need to deal with the horizontal scroll bar.

        Never underestimate the power of human stupidity RAH

        C 1 Reply Last reply
        0
        • M Mycroft Holmes

          Ok here you are going outside the design limitations of the control you are using. You have 2 basic choices, find an alternative control that meets your requirements (Infragistics and DevExpress are 2 suppliers) or create your own control. 1. The background colour of the selected item is probably managed by the skin/style windows is using. 2. You are asking it to paint the listviews backgound area according to a control (item) that is not there. As Eric said expand the last subitem to the full width, except then you need to deal with the horizontal scroll bar.

          Never underestimate the power of human stupidity RAH

          C Offline
          C Offline
          Cyrilix
          wrote on last edited by
          #4

          Yeah, I see that it may be a little tough to do this. I ended up taking the ListBox and overriding some of its functionality.

          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