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

Problem with Binding Two Way in RadRichTextBox

1 Answer 38 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 13 Dec 2011, 12:51 PM
Hi,

I´ve a problem with RadRichTextBox. When I try use in my richtextbox binding twoway, the application give me an inner exception. Here are my xaml code:

<telerikHtml:HtmlDataProvider x:Name="HtmlProvider" RichTextBox="{Binding ElementName=LeitorTemplateNotif}" Html="{Binding Path=ConteudoProp,Mode=TwoWay}"/>
                                        <telerik:RadRichTextBox Margin="-1,3,0,0" Grid.Column="1" Grid.Row="0" Width="500" MaxWidth="500" Height="225" MaxHeight="255" Name="LeitorTemplateNotif" IsReadOnly="False" Visibility="{Binding Path=DataContext.VisibilidadeConteudoPropDataForm,Mode=TwoWay, ElementName=LayoutRoot}"/>

And my viemodel:

 public void DF_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
        {
            this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
                                      Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
                                      Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete |
                                      Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Commit |
                                      Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Cancel;
            
            if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
            {
                if (this.novoItem)
                {
                    bool i;
                    TemplatesNotificacoes tn = new TemplatesNotificacoes();
                    tn.IdProp = -1;
                    tn.DesignacaoProp = TemplateNotificacaoSeleccionada.DesignacaoProp;
                    tn.TipoNotificacaoIdProp = TemplateNotificacaoSeleccionada.TiposnotificacaoProp.IdProp;
                    tn.ConteudoProp = TemplateNotificacaoSeleccionada.ConteudoProp;
                    tn.SitProp = 1;
                    tn.InsDataProp = DateTime.Now;
                    tn.InsUserProp = AppGlobais.Globais.Utilizador.LoginProp;
                    tn.AltDataProp = null;
                    tn.AltUserProp = null;
                    tn.VersaoProp = 0;
                    if (tn.DesignacaoProp != null)
                    {
                        i = contextoSGA.TemplatesNotificacoes.Any(a =>
                                                                                         a.DesignacaoProp.ToUpper().Trim() == tn.DesignacaoProp.ToUpper().Trim());
                        if (i == true)
                        {
                            parametrosJanela.Closed = null;
                            parametrosJanela.Header = "Template de Notificação Existente";
                            parametrosJanela.Content = "\nJá existe um Template de Notificação\ncom a designacao:\n\n[" + tn.DesignacaoProp + "]";
                            RadWindow.Alert(parametrosJanela);
                            BloquearLeituraEscritaDados = false;
                        }
                        else
                        {
                            contextoSGA.TemplatesNotificacoes.Add(tn);
                            BloquearLeituraEscritaDados = true;
                            this.novoItem = false;
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                    if (TemplateNotificacaoSeleccionada.DesignacaoProp != null)
                    {
                        if (TemplateNotificacaoSeleccionada.HasChanges)
                        {
                            TemplatesNotificacoes tn = TemplateNotificacaoSeleccionada;
                            tn.TipoNotificacaoIdProp = TemplateNotificacaoSeleccionada.TiposnotificacaoProp.IdProp;
                            tn.SitProp = 1;
                            tn.AltDataProp = DateTime.Now;
                            tn.AltUserProp = AppGlobais.Globais.Utilizador.LoginProp;
                            tn.VersaoProp += 1;

                            bool i = contextoSGA.TemplatesNotificacoes.Any(a =>
                                                                                                  a.DesignacaoProp.ToUpper().Trim() == tn.DesignacaoProp.ToUpper().Trim() &&
                                                                                                  a.IdProp != tn.IdProp);
                            if (i == true)
                            {
                                parametrosJanela.Closed = null;
                                parametrosJanela.Header = "Template de Notificação Existente";
                                parametrosJanela.Content = "\nJá existe um Template de Notificação\ncom a designacao:\n\n[" + tn.DesignacaoProp + "]";
                                RadWindow.Alert(parametrosJanela);
                                contextoSGA.RejectChanges();
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
        }


I don´t know how fix that, I need the twoWay mode to save data in DB.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Andrew
Telerik team
answered on 16 Dec 2011, 06:33 PM
Hello Manuel,

Unfortunately, we could not reproduce your problem. We are attaching a project illustrating two way binding using HtmlDataProvider.

You can check it out and if you still can't resolve your issue, please send us a sample project showing the problem.

Greetings,
Andrew
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Manuel
Top achievements
Rank 1
Answers by
Andrew
Telerik team
Share this question
or