.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> WPF >> Post New QuestionBookmark and Share Subscribe to Forum

Display ListView Items Horizontally in FlowDocument(WPF)

Posted By: Sajid P K     Posted Date: October 15, 2010    Points:2   Category :WPF
Requirement: In Flow Documents,I am binding a collection(i.e. a List) to a ListView.Accodring to the requirements,items of collection should get displayed horizontally.E.g. if we have a,b,c in a list then it should be displayed like:
Presently it is getting printed like:

I have used wrappanel,stackpanel with orientation=horizontal.Also,I have used HorizontalContentAlignment=ture with List.
I have used following code:
<ListView BorderThickness="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path= Path of collection}" ItemContainerStyle="{StaticResource name of style}">

<WrapPanel >
<TextBlock Text="{Binding Path=Value}" TextWrapping="Wrap"/>


Please HELP me on this ?

Author: Syed Shakeer Hussain             
Posted Date: October 16, 2010     Points: 5   

Hi Sajid,
To dispaly data Horizatally, try with the below code:

<ListView x:Name:"list1" >
<StackPanel Margin="5" Orientation="Horizatal">
<TextBlock Text="{Binding Name1}" />
<TextBlock Text="{Binding Name2}" />
<TextBlock Text="{Binding Name3}" />

</StackPanel >

and finally add your list.ItesmsSource.

Let me know if it works

Author: Sajid P K             
Posted Date: October 16, 2010     Points: 5   

Hussain ,

Yes.... its working fine.

Thanks lot.

Sajid P K

Author: Syed Shakeer Hussain             
Posted Date: October 17, 2010     Points: 5   

Then make it as Answered

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend