Click here to Skip to main content
15,888,733 members
Home / Discussions / WPF
   

WPF

 
QuestionListView selecteditem Pin
Jacob Dixon26-Jul-09 15:23
Jacob Dixon26-Jul-09 15:23 
QuestionProblems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
SBJ26-Jul-09 7:50
SBJ26-Jul-09 7:50 
AnswerRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
Michael Sync28-Jul-09 6:04
Michael Sync28-Jul-09 6:04 
GeneralRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
SBJ28-Jul-09 12:32
SBJ28-Jul-09 12:32 
GeneralRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
Michael Sync29-Jul-09 5:12
Michael Sync29-Jul-09 5:12 
GeneralRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
SBJ11-Aug-09 15:31
SBJ11-Aug-09 15:31 
QuestionHow to build a WPF report for WPF application ? Pin
error197926-Jul-09 6:19
error197926-Jul-09 6:19 
AnswerRe: How to build a WPF report for WPF application ? Pin
Sperneder Patrick26-Jul-09 7:46
professionalSperneder Patrick26-Jul-09 7:46 
hi error,

There are plenty much commercial solutions out there. Try Google with 'WPF Reporting'.

If you want to keep things simpler and are not afraid of writing a little bit code, you could do the job with WPF's FlowDocument.
Just bind the corresponding fields to TextBlock / TextBox items in the Document and voila ...

First step : Create a FlowDocument with it's content and placeholders.
( This is maybe a very poor example, but it should give you a kick into the right direction )
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              ColumnWidth="400" FontSize="14" FontFamily="Georgia">
    <Paragraph>
        <!-- Header-->
        <TextBlock Text="Header of the Report ...." />
        <!-- Binding of Fields -->
        <TextBlock Text="{Binding Path=DesiredFieldName}" />
        <!-- Footer -->
        <TextBlock Text="Footer of the Report ...." />
    </Paragraph>
 </FlowDocument>


Step two : Instanciate your FlowDocument ( in this case from within C# code )

string xaml = null;
StreamResourceInfo sri = Application.GetResourceStream(new Uri(@"..\Documents\Report.xaml", UriKind.Relative));

using (StreamReader reader = new StreamReader(sri.Stream))
{
    xaml = reader.ReadToEnd();
}
FlowDocument myReport = (FlowDocument)XamlReader.Parse(xaml);


Step three : Bind the source to your FlowDocument ( Report ), so it's 'fields get filled' by binding.
For example with the EntityFramework as dataprovider. ( Again this is just an example ! You could do this with nearly every datasource )

using(Entities ctx = new Entities())
{
    myReport.DataContext = from c in ctx.articles select c.price;
}



And finally : If you want to show your generated report, you could do so showing it in an FlowDocumentReader.

<FlowDocumentReader Name="myReportViewer" />


And now set our generated report to the Document property of the FlowDocumentReader ...

myReportViewer.Document = myReport;



Let me know if that helped you.

Cheers Doc.NET.Noodles Poke tongue | ;-P

(PS.: Dont forget to vote if that answer helped you. )
AnswerRe: How to build a WPF report for WPF application ? Pin
Pete O'Hanlon26-Jul-09 10:25
mvePete O'Hanlon26-Jul-09 10:25 
QuestionBackGroundWorker In WPF Problem Pin
Member 306874125-Jul-09 14:56
Member 306874125-Jul-09 14:56 
AnswerRe: BackGroundWorker In WPF Problem Pin
Mark Salsbery27-Jul-09 5:21
Mark Salsbery27-Jul-09 5:21 
Questionhi,how should i use wpf draw staff gauge ? Pin
KornZhang25-Jul-09 5:23
KornZhang25-Jul-09 5:23 
AnswerRe: hi,how should i use wpf draw staff gauge ? Pin
KornZhang25-Jul-09 5:24
KornZhang25-Jul-09 5:24 
QuestionWPF browser application on MAC browsers Pin
VijayVishwakarma25-Jul-09 2:21
VijayVishwakarma25-Jul-09 2:21 
AnswerRe: WPF browser application on MAC browsers Pin
teejayem25-Jul-09 11:35
teejayem25-Jul-09 11:35 
QuestionWebsite + wpf application Pin
bhavna432124-Jul-09 20:57
bhavna432124-Jul-09 20:57 
QuestionRe: Website + wpf application Pin
Mark Salsbery27-Jul-09 5:23
Mark Salsbery27-Jul-09 5:23 
QuestionCustom property for user control Pin
krishnan.s24-Jul-09 20:32
krishnan.s24-Jul-09 20:32 
AnswerRe: Custom property for user control Pin
BillWoodruff24-Jul-09 22:54
professionalBillWoodruff24-Jul-09 22:54 
Questionequivalent method Dispose() in WPF? Pin
mehdibahadori24-Jul-09 19:25
mehdibahadori24-Jul-09 19:25 
AnswerRe: equivalent method Dispose() in WPF? [modified] PinPopular
#realJSOP24-Jul-09 23:02
mve#realJSOP24-Jul-09 23:02 
GeneralRe: equivalent method Dispose() in WPF? Pin
Pete O'Hanlon27-Jul-09 1:59
mvePete O'Hanlon27-Jul-09 1:59 
AnswerRe: equivalent method Dispose() in WPF? Pin
Kunal Chowdhury «IN»26-Jul-09 20:21
professionalKunal Chowdhury «IN»26-Jul-09 20:21 
QuestionMessage Removed Pin
24-Jul-09 9:48
professionalN_tro_P24-Jul-09 9:48 
AnswerMessage Removed Pin
24-Jul-09 9:49
professionalN_tro_P24-Jul-09 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.