How can I save the contents of a FlowDocumentReader as an XAML file ?
This example demonstrates how to save the contents of a FlowDocumentReader (represented by the ‘Document’ property) as an XAML file. [XAML] <FlowDocumentReader Name=’flowDocRdr’ IsFindEnabled=’True’ IsPrintEnabled=’True’ MinZoom=’50’ MaxZoom=’1000′ Zoom=’120′ ZoomIncrement=’5′ /> To save the contents of the FlowDocumentReader to a file, open or create the file stream and use the ‘Save()’ method provided by the ‘XAMLWriter’ class to write the FlowDocument to the file stream. [C#] void SaveFlowDocumentReaderWithXAMLFile(string fileName) { // Open or create the output file. FileStream xamlFile = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite); // Save the contents of the FlowDocumentReader to the file stream that was just opened. XamlWriter.Save(flowDocRdr.Document, xamlFile); xamlFile.Close(); }
How can I load an XAML file into a FlowDocumentReader?
This example demonstrates how to parse an XAML file that contains a FlowDocument and display the loaded file in a FlowDocumentReader. [XAML] <FlowDocumentReader Name=’flowDocRdr’ IsFindEnabled=’True’ IsPrintEnabled=’True’ MinZoom=’50’ MaxZoom=’1000′ Zoom=’120′ ZoomIncrement=’5′ /> And write the following FlowDocument to the file stream : [C#] void LoadFlowDocumentReaderWithXAMLFile(string fileName) { // Open the file that contains the FlowDocument… FileStream xamlFile = new FileStream(fileName, FileMode.Open, FileAccess.Read); // and parse the file with the XamlReader.Load method. FlowDocument content = XamlReader.Load(xamlFile) as FlowDocument; // Finally, set the Document property to the FlowDocument object that was // parsed from the input file. flowDocRdr.Document = content; xamlFile.Close(); }
How do I position the children of a Canvas at a discreet X but stretch them vertically to fill?
You can do so by binding the child’s Height to the Canvas’s ActualHeight, as follows: [XAML] <Canvas Name=’myCanvas’> <Grid Canvas.Left=’10’ Width=’20’ Height='{Binding ElementName=myCanvas, Path=ActualHeight}’ > </Grid> </Canvas>
How can I Enable ASPX Compression in IIS
You can use Http Compression to compress static aspx files. Refer Microsoft Knowledge Base Article – 322603
Why do I get the error message ‘Sql Server does not exists or access denied ‘ whenever I try to access the data on Sql server
The ASP.NET worker process doesn’t have the correct permissions to connect to or write to the SQL Server database. Either enable impersonation for users, or configure the ASP.NET worker process to run under the SYSTEM account. The ASPNET account cannot establish a named pipes connection to the database server. Try using TCP/IP instead of the Named Pipes protocol to connect to the database by adding ‘Network Library =dbmssocn’ in your connection string For more information refer BUG: Named pipes do not work when worker process runs under ASPNET account Process and request identity in ASP.NET