views:

29

answers:

1

In the performance of this code is an error Cannot serialize a nested public type 'System.Windows.Forms.AxHost+State'.

FlashControl my usercontrol

<UserControl x:Class="Adminka.UserControls.FlashControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             xmlns:controls="clr-namespace:MyBlogUserControls;assembly=MyBlogUserControls">
    <Grid>
        <controls:FlashPlayer/>
    </Grid>
</UserControl>

FlashPlayer - usercontrol for view flash

fd is a richtextbox, i need to replace FlashControl on TextBox, but an error occurs

error -  Cannot serialize a nested public type 'System.Windows.Forms.AxHost+State'.


    for (int i = 0; i < fd.Blocks.Count; i++)
    {
        var block = (fd.Blocks as BlockCollection).ElementAt(i);
        if (block is Paragraph)
        {
            var p = new Paragraph();
            for (int y = 0; y < ((Paragraph)block).Inlines.Count; y++)
            {
                var inline = ((Paragraph)block).Inlines.ElementAt(y);
                if (inline is InlineUIContainer)
                {
                    var elem = ((InlineUIContainer)inline).Child;
                    if (elem is FlashControl)
                    {
                        elem = new TextBox() { Text = string.Format(format, "FlashControl", (elem as FlashControl).FlashPlayer.Source) };
                    }
                    ((InlineUIContainer)inline).Child = null; \\error occurs here
                }
            }
            block = p;
        }
    }

how to replace FlashControl on TextBox ?

A: 

Can you explain why you're trying to serialize the web browser control? My bet is that's not going to work.

What is it you're trying to accomplish? Maybe then we can help you with your real issue.

Judah Himango
I serialize content RichTextBox, for saved and transmit... Admin create Articul in richtextbox, and Client read this articul.
simply denis
Rather than serialize the RichTextBox like this, call document.Save method: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/19f2bc6a-95dc-4dea-b070-328638f32990
Judah Himango