I am using a RadRichTextBox as a Rich Content Viewer. (WPF 40)
What is the correct way to Bind TransitionControl with fadeEffect to a read-only RadRichTextBox (RRTB) control?
There is no user input in this process. (Remote display only)
The RadRichTextBox is loaded from Database with Html from code behind on a seperate thread every 5 seconds.
Is there an example of binding RRTB Data Context to transition, or an example of binding a RRTB Data Template to transition?
Because it’s Read-only, How do I bind the changing Data (with HtmlFormatProvider or RRTB directly)
Or is there a strictly XAML way to bind with declaratives?
I am trying to keep this as simple as possible.
What do I have to do to the following code to add Fade Transition to RadRichTextBox1?
The XAML:
<telerik:RadRichTextBox x:Name="RadRichTextBox1"
IsReadOnly="True"
IsEnabled="True"
IsSelectionEnabled="False"
IsFocusable="False"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Height="595"
Width="1050"
Margin="20,122,0,0">
</telerik:RadRichTextBox>
VB - Code Behind Snippet:
Dim HtmlMsg as String= MSG_TXT.ToString ‘ load HTML from DB
Me.RadRichTextBox1.IsSpellCheckingEnabled = False
Me.RadRichTextBox1.Document = Me.htmlFormatProvider.Import(HtmlMsg)
‘
<telerik:RadDataForm.LabelStyle> <Style TargetType="ContentControl"> <Setter Property="IsTabStop" Value="False" /> </Style></telerik:RadDataForm.LabelStyle> class CustomGridViewToggleRowDetailsColumn : GridViewBoundColumnBase { public static RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent( "Click", RoutingStrategy.Bubble, typeof( ToggleRowDetailsColumnRoutedEventHandler ), typeof( CustomGridViewToggleRowDetailsColumn ) ); public GridViewCell Cell { get; set; } public event RoutedEventHandler Click { add { AddHandler( ClickEvent, value ); } remove { RemoveHandler( ClickEvent, value ); } } public override object Header { get { return null; } set { base.Header = value; } } public GridViewToggleButton ToggleButton { get; set; } private Binding toggleButtonVisibility; public Binding ToggleButtonVisibility { get { return toggleButtonVisibility; } set { toggleButtonVisibility = value; } } public CustomGridViewToggleRowDetailsColumn() { // Set the EditTriggers property to None this.EditTriggers = GridViewEditTriggers.None; } public override bool CanFilter() { return false; } public override bool CanGroup() { return false; } public override bool CanSort() { return false; } public override FrameworkElement CreateCellElement( GridViewCell cell, object dataItem ) { Cell = cell; ToggleButton = new GridViewToggleButton { Margin = new System.Windows.Thickness( 3 ) }; ToggleButton.Click += new RoutedEventHandler( ToggleButton_Click ); if ( this.DataMemberBinding != null ) { ToggleButton.SetBinding( GridViewToggleButton.IsCheckedProperty, this.DataMemberBinding ); } if ( ToggleButtonVisibility != null ) { ToggleButton.SetBinding( GridViewToggleButton.VisibilityProperty, ToggleButtonVisibility ); } GridViewRow row = cell.ParentRow as GridViewRow; row.SetBinding( GridViewRow.DetailsVisibilityProperty, new Binding( "IsChecked" ) { Source = ToggleButton, Converter = new BooleanToVisibilityConverter(), Mode = BindingMode.TwoWay } ); return ToggleButton; } void ToggleButton_Click( object sender, RoutedEventArgs e ) { RoutedEventArgs newEventArgs = new ToggleRowDetailsColumnRoutedEventArgs( ClickEvent, Cell ); RaiseEvent( newEventArgs ); } } public class ToggleRowDetailsColumnRoutedEventArgs : RoutedEventArgs { public GridViewCell Cell { get; set; } public GridViewRow Row { get { return Cell.ParentRow as GridViewRow; } } public ToggleRowDetailsColumnRoutedEventArgs( RoutedEvent routedEvent, GridViewCell cell ) : base( routedEvent ) { Cell = cell; } } public delegate void ToggleRowDetailsColumnRoutedEventHandler( object sender, ToggleRowDetailsColumnRoutedEventArgs e ); } ControlTemplate
<ControlTemplate x:Key="GridViewToggleButtonTemplate" TargetType="telerik:GridViewToggleButton"> <Border Background="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <Border Width="80" Height="20" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"> <Grid x:Name="myGrid"> <TextBlock Text="Details" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </Border> </Border> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="myGrid" Property="Background" Value="Red" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="telerik:GridViewToggleButton" x:Key="toggleButtonStyle"> <Setter Property="Template" Value="{StaticResource GridViewToggleButtonTemplate}" /> </Style>
And applied this style in telerik:RadGridView.Columns as below
<telerik:GridViewToggleRowDetailsColumn ToggleButtonStyle="{StaticResource toggleButtonStyle}" />
But this doesn't work so please let know how do i fix this problem.
Thanks in advance.
mChartControl.AxisElementBrush = new SolidColorBrush(value);