How I can Save layout in Silverlight - silverlight

I am working on silverlight application and I want save layout as a sheet.
The flow is here.
I Have StackPanel and children of StackPanel is WrapPanel and inside the WrapPanel I am adding multiple Images.
The Size of the StackPanel is according to user define height and width.
so how I can save this sheet.
Thanks..!!!!

In WPF there exists a XamlWriter which can write your Visual Tree to a XAML string. However, this is not available in the Silverlight APIs. Fortunately someone has written a XamlWriter for Silverlight and it is available here:
http://www.davidpoll.com/2010/07/25/to-xaml-with-love-an-experiment-with-xaml-serialization-in-silverlight/
With this you can save your 'sheet' to a XAML string, the use XamlReader.Load to reconstruct it:
http://msdn.microsoft.com/en-us/library/cc189076%28VS.95%29.aspx

Related

Images without borders in PropertyGrid control

Using windows forms PropertyGrid control I can add images into select for any property using some UI type converters, etc. This control adds black border for each picture in the list. Does anybody know how to remove it?
See the samples of desired and existing picture here
and
Use the following line of code in your custom UITypeEditor class before drawing the image:
e.Graphics.ExcludeClip(e.Bounds);

Can a UserControl be saved as XAML at runtime in WPF?

I have a UserControl that includes Labels, TextBox and Charts (generic types). After the user loads this control in a grid at runtime, can it be saved as XAML? So a later user can load his file and edit it. If the UserControl cannot be saved as XAML what is the other way to save it?
Thanks for any inputs,
I think you will want to look at the XamlWriter / XamlReader Classes. There are some limitations but they might work for you.

Making a custom(/templated) ScrollViewer or ListBox that understands which item to bring to view

I am trying to make a panorama-like control in WPF c# that scrolls to/brings into view only one grid from a horizontal set of grids. I need to expose the command which allows me to scroll forward/backward from various controls (which using an InteractionTrigger would suffice) on any of the grids in the ScrollViewer or ListBox.
I want each of the internal grids to size to the actual height/width of the usercontrol they live in (like tiled pages), won't need any scrollbars, and will eventually be applying easing effects/states to each of the scroll positions.
If this is too vague/convoluted, please let me know.
Thanks in advance! :)
Easy Solution:
PathListBox. Downloaded the PathListBox toolkit (for the PathListBoxScrollBehavior), set the capacity to 1, and used the templated InteractionTriggers to bind various source objects on my grids to the InvokeCommandAction Increment/Decrement Commands. Then I added easing effects/GoToStateActions.
I realize this is sort of a cheat, but am still going to search for the "real" way to do this with custom control templates deriving from ListBox and/or ScrollViewer.

Displaying dynamic text with hyperlinks in Silverlight

I have an application that should work a bit like a message board: text gets parsed, hyperlinks are made "live" and displayed. Only it's in Silverlight. Because of that, I can't use TextBlock like they do here WPF - Making hyperlinks clickable, somehow it's different in Silverlight and it's not possible to do a Hyperlink with a Run inside it.
I've tried the RichTextBlock, as it says here Wrapping Text and Hyperlinks in Silverlight, but couldn't for the life of me figure out how to create the paragraphs and hyperlinks from code, since I need to populate it dynamically.
Then I thought I'd settle for a less elegant solution involving TextBlocks and HyperlinkButtons in a WrapPanel. I added a namespace reference, like it says here WrapPanel in Silverlight 4 toolkit, but when I reference it in XAML, there's no WrapPanel in it, only DataField, DataForm and VisualStateManager.
This Text areas and hyperlinks? doesn't work either, the Silverlight RichTextBox is different and LinkLabel is missing.
Maybe there's another solution that I don't know? I'm keeping an open mind. Any help appreciated.

How to style a custom Silverlight 4 UserControl?

I have a custom UserControl that I created as a navigation menu that parses an xml file and populates itself with hyperlink buttons. So basically my control is an empty stackpanel, and when it's loaded it adds hyperlinkbuttons as children to the stack panel.
In my application I just add a <myLibrary:NavigationMenu links="somexml.xml" />
The problem is that I want to be able to style the hyperlinkbuttons and the stack panel differently for every application. What is the best way to do this.
In the code behind for the control, create a DependencyProperty of type Style for both HyperlinkStyle and StackPanelStyle. Then when you create the items apply the correct styles too them.
Take a look at MSDN
The article is a good starting point for writing stylable controls.

Resources