How to implement a crystal report in a WPF application
Kamal Gurnani
Posts
-
Crystal reports with WPF -
default control template xamlThe WPF documentation doesn’t list the XAML for standard control templates. But, you can write program to get the control template and then modify it and Re-Apply it. Here is the program to get the control Template Markup of a given control. In a Main window take a listbox control to enlist all the controls, and when any item is selected the corrosponding Control Template's Markup is displayed in a Textblock control. Here is the WPF program to demonstrate the same This is the XAML part <Window x:Class="DefaultControlTemplate.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="462" Width="572" Loaded="Window_Loaded" > <Grid> <ListBox Margin="12,12,0,12" Name="listBox1" HorizontalAlignment="Left" Width="168" SelectionChanged="listBox1_SelectionChanged" /> <TextBlock HorizontalAlignment="Right" Margin="0,14,12,10" Name="textBlock1" Width="159" /> </Grid> </Window> This is how .cs file would look like private void Window_Loaded(object sender, RoutedEventArgs e) { Type controlType = typeof(Control); List<Type> ctrlTypes = new List<Type>(); //searches all the types in a dll where generic control class is defined Assembly assembly = Assembly.GetAssembly(typeof(Control)); foreach (Type type in assembly.GetTypes()) { // Only add a type of the list if it's a Control, a concrete class, // and public. if (type.IsSubclassOf(controlType) && !type.IsAbstract && type.IsPublic) { ctrlTypes.Add(type); } } listBox1.ItemsSource = ctrlTypes; } ------------------------------------------------------------ private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { // Get the selected type. Type type = (Type)listBox1.SelectedItem; // Instantiate the type. ConstructorInfo info = type.GetConstructor(System.Type.EmptyTypes); Control control = (Control)info.Invoke(null); // Get the template. ControlTemplate template = control.Template;
-
Silverlight XAML controls [modified]Hi, In my Silverlight Apps, I m unable to drag and drop 'Silverlight XAML controls' on the page.xaml surface. I could add the same by typing XAML markups. Whats the problem? I m using Visual Studio 2008 with VS 2008 SP1.
modified on Friday, June 19, 2009 4:13 AM
-
WCF service with multiple EndPoints [modified]I could see now config file is pretty visible
-
Overview: WPFWhy WPF To build Desktop applications, Microsoft came up with numerous APIs over the years, like Win32 API, MFC, VB 6.0 and lately .NET Winform. Typically in a full fledged desktop application, you would like to have diverse User interfaces like controls, 2D Graphics, 3D-Graphics and may be optionally (say by clicking on Advanced.. button) you want to have Media and Animation. Looking at above APIs from Microsoft, It is difficult for a Windows Programmer to master diverse nature of each API for a particular User interface. Apart from this, in all above technologies more or less the overall Layout was fixed. In other words, Layout couldn't adapt itself easily to different window sizes. Finally, In all above technologies, there is no way to separate the Graphical contents from code. Say e.g in WinForm Apps, when you drag and drop a control on a form surface framework generates C# code. It also means that to change the look and feel of any control you will have to deal with code. This is where Microsoft came up with 'Windows Presentation Foundation' (WPF) Windows Presentation Foundation is a one of the .NET components which allows you to develop the Next Generation Desktop Application with very rich user interfaces. WPF is available from .NET 3.0 onwards. It is one of the components of .NET 3.0 and .NET 3.5 frameworks ------------------------------------------------------------------------------------------------- WPF Features: 1) Single Unified programming Model for different User Interfaces like 2D Graphics, 3D Graphics, Media, Document API and Animation 2) Declarative User interface through XAML 3) Separation of Business logic from UI part through *XAML 4) Flexible Layout Model (no use of coordinates of control w.r.t to window) 5) Lookless controls (without fixed size) 6) Enhanced Designer and Developer productivity. Designer can work on UI aspect through *XAML file and developer would be busy with corresponding .cs file 7) Powerful data binding model 8) Hardware acceleration. WPF drawing is performed through DirectX. --------------------------------------------------------------------------------------------------- WPF's basic programming Infrastructure -> Declarative programming Style using *XAML (Using XAML is optional) -> Dependency Properties wrapped under normal .NET properties -> Routed Events -> Control Commands --------------------------------------------------------------------------------------------------- *XAML (Zammel) is XML based mar
-
WCF service with multiple EndPoints [modified]I have a WCF service where service class implements two contracts IMath and IGeom. In turn, I want this service to be consumed through two Endpoints. IMath should be exposed through netTcpBidning and IGeom through basicHttpBinding. Problem is when I m creating proxy second time to call upon IGeom methods, (One for IMath, one more for IGeom),under some different namespace, through visual studio, it has all the methods of IMath apart from expected IGeom methods. Here is how my config file looks like <services> <service name ="MultipleEPService.MathService" behaviorConfiguration="MathServiceMEXBehaviour" > <endpoint address="math" binding="netTcpBinding" contract="MultipleEPService.IMath"/> <endpoint address ="geom" binding ="basicHttpBinding" contract ="MultipleEPService.IGeom"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> <endpoint address ="mex" binding="mexTcpBinding" contract ="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="http://localhost:4242/MathService.svc"/> <add baseAddress="net.tcp://localhost:8002/MathService.svc"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MathServiceMEXBehaviour"> <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> Where m I making mistake plz suggest. Thanks
modified on Friday, May 22, 2009 7:19 AM
-
Message Encoding InfosetWhat is 'InfoSet' in message encoding context?
-
Web Service Software FactoryHi, What is Web Service Software Factory and Web Client Software Factory?
-
ASP.NET MVC web AppThanks.
-
ASP.NET MVC web AppHi, I have installed .NET Framework 3.5 SP1, but I m not getting 'ASP.NET MVC Web Application' project template? Plz let me know how to get the same? Is there anything else required?
-
ASP.NET MVC web AppHi, I have installed .Net Framework 3.5 SP1, but not getting 'ASP.NET MVC Web Application' project template. Plz let me know how to get the same? Thanks Kamal
-
LINQ Scenario