Text and Image in header in listview
-
Hi, I need to display image and text together to the header in the Listview in wpf.Can u please let me know how to implement the same in wpf. Thanks
-
Hi, I need to display image and text together to the header in the Listview in wpf.Can u please let me know how to implement the same in wpf. Thanks
krishnan.s wrote:
the header in the Listview
ListView does't have a header. Are you referring to GridView? If so, you can set the HeaderTemplate on a GridViewColumn.
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
krishnan.s wrote:
the header in the Listview
ListView does't have a header. Are you referring to GridView? If so, you can set the HeaderTemplate on a GridViewColumn.
Mark Salsbery Microsoft MVP - Visual C++ :java:
Ya its the grid view iam referring too . Iam ale to display onlyone at a time , either text or image, Iam not getting how to display both together.Can u please let me know how to display both image and text in the single header cell. Thanks
-
Ya its the grid view iam referring too . Iam ale to display onlyone at a time , either text or image, Iam not getting how to display both together.Can u please let me know how to display both image and text in the single header cell. Thanks
krishnan.s wrote:
Iam ale to display onlyone at a time , either text or image, Iam not getting how to display both together
Use a panel that can host more than one element. Here's an example using a StackPanel:
<ListView x:Name="booksListView" ItemsSource="{Binding Source={StaticResource BooksData}, XPath=\*}" > <ListView.View> <GridView AllowsColumnReorder="False" > <GridViewColumn Width="100" DisplayMemberBinding="{Binding XPath=@ISBN}" > `<GridViewColumn.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="Header Text" /> <Image Source="images/Silverlight_Logo.jpg" /> </StackPanel> </DataTemplate> </GridViewColumn.HeaderTemplate>` </GridViewColumn> <GridViewColumn Header="Title" Width="140" DisplayMemberBinding="{Binding XPath=Title}" /> <GridViewColumn Header="Summary" Width="140" DisplayMemberBinding="{Binding XPath=Summary}" /> <GridViewColumn Header="Price" Width="35" DisplayMemberBinding="{Binding XPath=price}" /> <GridViewColumn Header="Stock" Width="35" DisplayMemberBinding="{Binding XPath=@Stock}" /> </GridView> </ListView.View> </ListView>
Mark Salsbery Microsoft MVP - Visual C++ :java: