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 ?