This is a migrated thread and some comments may be shown as answers.

RADPlayer inside richtextbox/raddocument

1 Answer 68 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Irfan
Top achievements
Rank 1
Irfan asked on 03 Jan 2011, 08:12 PM
Hello,

We added the radplayer inside the rixhtextbox raddocument. (Office style ), but when we play the media in player and then save the document.
It is also storing the position of the played media inside the player. when we try to open the same document in the same richtextbox raddocument it starts giving us an error. of the position element .


Please advise?

Thank you in advance.
Kind Regards

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 05 Jan 2011, 09:51 AM
Hello Dynovative,

 The exception occurs because the Deserializer tries to set the Position property before the Loaded event of the RadMediaPlayer, which is currently not supported. We have created a PITS issue about this feature and you can track its development here.
As a workaround, you can exclude the Position property "manually" before export or import of the file,. You can do the stripping using a regular expression, or in the following manner (here it's implemented before import):

private void btnOpen_Click(object sender, RoutedEventArgs e)
{
    OpenFileDialog dialog = new OpenFileDialog();
    if (dialog.ShowDialog() == true)
    {
        using (StreamReader stream = new StreamReader(dialog.File.OpenRead()))
        {
            string xaml = stream.ReadToEnd();
            string stripStr = "Position=\"";
            int pos = xaml.IndexOf(stripStr);
            while (pos != -1)
            {
                int pos2 = xaml.IndexOf("\"", pos + stripStr.Length);
                xaml = xaml.Substring(0, pos) + xaml.Substring(pos2 + 1);
                pos = xaml.IndexOf("Position=\"");
            }
 
            this.radRichTextBox1.Document = new XamlFormatProvider().Import(xaml);
        }
    }
}

As a sign of gratitude for your bug report, we have updated the Telerik points in your account.

Kind regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
RichTextBox
Asked by
Irfan
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or