RADPlayer inside richtextbox/raddocument

2 posts, 0 answers
  1. Irfan
    Irfan avatar
    3 posts
    Member since:
    Oct 2010

    Posted 03 Jan 2011 Link to this post

    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
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 05 Jan 2011 Link to this post

    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
  3. DevCraft banner
Back to Top