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. Creating Custom Control in WPF (.Net 3.5)

Creating Custom Control in WPF (.Net 3.5)

Scheduled Pinned Locked Moved WPF
csharpwpfgraphicsquestion
3 Posts 2 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.
  • M Offline
    M Offline
    Mehdi Ghiasi
    wrote on last edited by
    #1

    Dear Friends. I want to make a custom control for wpf that a custom combobox. I need to change combobox item drawing. how can I change it from code or access to XAML code of combobox in custom control project. (I'm using this code for inherit combobox:

    Public Class CustomControl1
    Inherits ComboBox

    )

    Regards. Mehdi Ghiasi

    P 1 Reply Last reply
    0
    • M Mehdi Ghiasi

      Dear Friends. I want to make a custom control for wpf that a custom combobox. I need to change combobox item drawing. how can I change it from code or access to XAML code of combobox in custom control project. (I'm using this code for inherit combobox:

      Public Class CustomControl1
      Inherits ComboBox

      )

      Regards. Mehdi Ghiasi

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Generally if you think that you want to change the appearance/behaviour of a control in XAML by creating a subclass, this means that you're approaching the problem in the wrong way. As the standard WPF controls are "lookless", this means that you can change the template to suit your own purposes. The only time that you should even consider inheriting is if you want to radically alter the behaviour of the underlying control - in other cases, you could consider implementing the functionality with Attached Properties/Attached Behaviours.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      M 1 Reply Last reply
      0
      • P Pete OHanlon

        Generally if you think that you want to change the appearance/behaviour of a control in XAML by creating a subclass, this means that you're approaching the problem in the wrong way. As the standard WPF controls are "lookless", this means that you can change the template to suit your own purposes. The only time that you should even consider inheriting is if you want to radically alter the behaviour of the underlying control - in other cases, you could consider implementing the functionality with Attached Properties/Attached Behaviours.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        M Offline
        M Offline
        Mehdi Ghiasi
        wrote on last edited by
        #3

        So, How can I make a Color Picker Combo Box (Color Picker Drop Down list) for my WPF Application? (I can make it in my program with both XAML and code. but in a class, I haven't XAML, how can I Change ItemTemplate of ComboBox? I've made this control for windows forms with DrawItem Event.)

        Regards. Mehdi Ghiasi

        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