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

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

XamlWriter, MarkupObject How to ?

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :WPF
I'm trying to serialize a tree of object in xaml in some designer app. some node of this tree refers to the same reference that i added to a resource dictionnary. XamlWriter won't serialize the reference to the dictionnary resources as a StaticResource + ResourceKey but i understand reading this post : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=286265&SiteID=1 that this should be possible using MarkupObject and modifying the ouput for some node.  let say :               Transform3DGroup TG1 = new Transform3DGroup();             Transform3DGroup TG2 = new Transform3DGroup();               TranslateTransform3D ts2 = new TranslateTransform3D();                  TG1.Children.Add(new TranslateTransform3D());             TG1.Children.Add(ts2);               TG2.Children.Add(new TranslateTransform3D());             TG2.Children.Add(ts2);    here's basically the output i'm looking for :     <Transform3DGroup x:Name="TG1">       <TranslateTransform3D/>       <StaticResource ResourceKey="ts2"/>     </Transform3DGroup>       <Transform3DGroup x:Name="TG2">       <TranslateTransform3D/>       <StaticResource ResourceKey="ts2"/>     </Transform3DGroup> Could someone provide me some information on how to achieve this ?   Thanks

View Complete Post

More Related Resource Links

How to avoid StackOverflowException when i use System.Windows.Markup.XamlWriter.Save

do following step, you can reappear the exception. step 1: Create a WpfApplication, named by "WpfApplication2" setp 2: Add two references, Microsoft.ReportViewer.Common and Microsoft.ReportViewer.WinForms step 3: paste the following code to MainWindow.xaml <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wf="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms" Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded"> <Grid> <WindowsFormsHost Height="100" HorizontalAlignment="Left" Margin="10,10,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="200" > <wf:ReportViewer Name="rp"></wf:ReportViewer> </WindowsFormsHost> </Grid> </Window> and paste the following code to MainWindow.xaml.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.M
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

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