WPF: Expand/Collapse items in ListView -


i have got following listview:

listview without hierarchy

at click on red button parent row want show subordinated rows. second click rows should hidden again.

i'm new @ wpf , have no idea 1. how row expandable/collapsable , 2. how create relationship between parent , children rows.

my xaml following:

<listview name="lvupgrade">     <listview.view>         <gridview>             <gridviewcolumn width="20px">                 <gridviewcolumn.celltemplate>                     <datatemplate>                         <image source="{binding path=icon}" />                     </datatemplate>                 </gridviewcolumn.celltemplate>             </gridviewcolumn>             <gridviewcolumn width="75px" displaymemberbinding="{binding path=time, stringformat={}{0:hh:mm:ss}}" />             <gridviewcolumn width="300px" header="nachricht" displaymemberbinding="{binding path=message}" />         </gridview>     </listview.view> </listview> 

the code behind:

public class upgrade      public sub addmessage(byval message message)         me.lvupgrade.items.add(message)     end sub      public class message          public enum messagetype              normal             information             success             warning             [error]         end enum          public sub new(byval type messagetype, byval message string)             _type = type             _message = message         end sub          private _type messagetype = messagetype.normal         public readonly property type messagetype                             return _type             end         end property          private _message string = string.empty         public readonly property message string                             return _message             end         end property          private _time datetime =         public readonly property time datetime                             return _time             end         end property          public readonly property icon bitmapimage                             select case me.type                     case messagetype.information                         return my.resources.information16.tobitmapimage                     case messagetype.success                         return my.resources.ok16.tobitmapimage                     case messagetype.warning                         return my.resources.alert16.tobitmapimage                     case messagetype.error                         return my.resources.error16.tobitmapimage                     case else                 end select                  return nothing             end         end property     end class end class 

you should use expander control

go on customizing wpf expander controltemplate


Comments

Popular posts from this blog

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

c# - Getting "Internal .Net Framework Data Provider error 30" error when column has NULL value -

android - Spacing between the stars of a rating bar? -