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


Top 5 Contributors of the Month
david stephan

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:
abc.
Presently it is getting printed like:
a
b
c

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}">
<ListView.ItemTemplate>
<DataTemplate>

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

</DataTemplate>
</ListView.ItemTemplate>
</ListView>

Please HELP me on this ?

Responses
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" >
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="5" Orientation="Horizatal">
<TextBlock Text="{Binding Name1}" />
<TextBlock Text="{Binding Name2}" />
<TextBlock Text="{Binding Name3}" />

</StackPanel >
</DataTemplate>
</ListView.ItemTemplate>
</ListView>




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.



Regards,
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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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