hi
How can I embed RTF text in xamDataGrid ? in particular one of the columns is called Description and I would like to allow users to past there text from word document or to type it manually and use simple RTF formatting
BR
PoKrec
as usual it was PEBKAC, MSDN says: "A TemplateBinding is an optimized form of a Binding for template scenarios, analogous to a Binding constructed with {Binding RelativeSource={RelativeSource TemplatedParent} Mode=OneWay}."
proper binding in my case should have been
{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=Value}then it works fine for <igDP:Field but stil for <igDP:UnboundField it does not work: RecordUpdated="OnRecordUpdated" is not invoked how to bind it correctly then?
I also faound this http://help.infragistics.com/NetAdvantage/WPF/2010.1/CLR3.5/?page=xamDataPresenter_Embedding_a_Custom_Control_in_a_Field.html
I did as in the example and it works to some extend, but I have problem that binding works only one way.
<Style x:Key="MyGrid_RtfCellPresenter" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Grid VerticalAlignment="Center"> <Common:RtfTextCell Height="32" Text="{TemplateBinding Value}" x:Name="RtfTextDescriptionCell"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> public partial class RtfTextCell : INotifyPropertyChanged { public RtfTextCell() { InitializeComponent(); } public string Text { get { return (string)this.GetValue(StateProperty); } set { this.SetValue(StateProperty, value); OnPropertyChanged("Text"); } } public static readonly DependencyProperty StateProperty = DependencyProperty.Register( "Text", typeof(string), typeof(RtfTextCell), new PropertyMetadata(string.Empty, TextChangedCallback)); static void TextChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {...} public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } }Am I forgetting about something? [I am new in WPF]( I've tried setting Text property mnually to make sure that SetValue is called and event is thrown)
Hello,
If you want to put a RichTextBox inside of the grid cells for a particular field, you can just retemplate the CellValuePresenter object via style. Then all you have to do is set the Field's CellValuePresenterStyle to the style that we would have just created. Here is a help article that uses an image to Retemplate the CellValuePresenter. Just change the Image to be a RichTextBox. That should work.
However, the RichTextBox does not bind very well, so there may be some tricks you have to do to bind a value to it. A quick google search will bring up many different approaches to making a RichTextBox bindable. Hope this helps.