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. List Control in WPF

List Control in WPF

Scheduled Pinned Locked Moved WPF
csharpc++wpf
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.
  • K Offline
    K Offline
    krishnan s
    wrote on last edited by
    #1

    Hi , I need to develop a Custom List control in WPF in which i need to customize the list header,the list selection,list background and need to add images to the listitem. I have created like this one in MFC with ownerdraw but not aware of WPF. Can anyone let me know some articles helping me to develop one. Thanks

    P 1 Reply Last reply
    0
    • K krishnan s

      Hi , I need to develop a Custom List control in WPF in which i need to customize the list header,the list selection,list background and need to add images to the listitem. I have created like this one in MFC with ownerdraw but not aware of WPF. Can anyone let me know some articles helping me to develop one. Thanks

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

      Why do you need to create a custom list control? The whole point behind the controls in WPF is that they are "lookless". In other words, their behaviour is separated from the visuals, so you can restyle existing controls with relative ease. Here's a (pretty completely) restyled version of a ListBox (thanks to KaXAML):

      <Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="{x:Type ScrollViewer}">
      <Setter Property="Template">
      <Setter.Value>
      <ControlTemplate TargetType="{x:Type ScrollViewer}">
      <Grid Background="{TemplateBinding Background}">
      <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*"/>
      <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
      <RowDefinition Height="*"/>
      <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel Margin="{TemplateBinding Padding}">
      <ScrollViewer
      DockPanel.Dock="Top"
      Focusable="false"
      HorizontalScrollBarVisibility="Hidden"
      VerticalScrollBarVisibility="Hidden">
      <GridViewHeaderRowPresenter
      Margin="2,0,2,0"
      AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder,RelativeSource={RelativeSource TemplatedParent}}"
      ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle,RelativeSource={RelativeSource TemplatedParent}}"
      ColumnHeaderContextMenu="{Binding Path=TemplatedParent.View.ColumnHeaderContextMenu,RelativeSource={RelativeSource TemplatedParent}}"
      ColumnHeaderTemplate="{Binding Path=TemplatedParent.View.ColumnHeaderTemplate,RelativeSource={RelativeSource TemplatedParent}}"
      ColumnHeaderTemplateSelector="{Binding Path=TemplatedParent.View.ColumnHeaderTemplateSelector,RelativeSource={RelativeSource TemplatedParent}}"
      ColumnHeaderToolTip="{Binding Path=TemplatedParent.View.ColumnHeaderToolTip,RelativeSource={RelativeSource TemplatedParent}}"
      Columns="{Binding Path=TemplatedParent.View.Columns,RelativeSource={RelativeSource TemplatedParent}}"
      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
      </ScrollViewer>
      <ScrollContentPresenter Name="PART_ScrollContentPresenter" KeyboardNavigation.DirectionalNavigation="Local"/>
      </DockPanel>
      <ScrollBar
      Name="PART_HorizontalScrollBar"
      Grid.Row="1"
      Maximum="{TemplateBinding ScrollableWidth}"
      Orientation="Horizontal"

      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