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. Style.TargetType = Interface || abstract class

Style.TargetType = Interface || abstract class

Scheduled Pinned Locked Moved WPF
csharphelp
2 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.
  • E Offline
    E Offline
    ezazazel
    wrote on last edited by
    #1

    Hi folks! Is it possible to define the targettype of a style to be an interface or an abstract class. Something like this (in pseudo code)

    Style s = new Style();
    s.TargetType = class where inherit from baseclass

    or

    Style s = new Style();
    s.TargetType = class which implements given interface

    This is needed for creating a generic dragdrop element, where the items in the source can be derived classes. e.g:

    abstract class DDItem
    {
    public T Identifier {get;set;}
    public Q DisplayableContent {get;set;}
    }

    /*Doesn't work like that*/
    <EventSetter Event="MouseLeftButtonDown" Handler="Drag"/>

    Would be fine to do this in plain c# as well. Help would be appreciated!

    K 1 Reply Last reply
    0
    • E ezazazel

      Hi folks! Is it possible to define the targettype of a style to be an interface or an abstract class. Something like this (in pseudo code)

      Style s = new Style();
      s.TargetType = class where inherit from baseclass

      or

      Style s = new Style();
      s.TargetType = class which implements given interface

      This is needed for creating a generic dragdrop element, where the items in the source can be derived classes. e.g:

      abstract class DDItem
      {
      public T Identifier {get;set;}
      public Q DisplayableContent {get;set;}
      }

      /*Doesn't work like that*/
      <EventSetter Event="MouseLeftButtonDown" Handler="Drag"/>

      Would be fine to do this in plain c# as well. Help would be appreciated!

      K Offline
      K Offline
      Kunal Chowdhury IN
      wrote on last edited by
      #2

      Why don't you try inheriting the Style itself?

      Silverlight 5 Tutorials :   1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

      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