or
//Focus RichTextBox - I have made my own Intellisense ListBox
radRichTextBox.Focus();
//Get Caret position (start position)
DocumentPosition startPosition =
new
DocumentPosition(radRichTextBox.Document);
//Insert text into document at caret position - text is from Intellisense ListBox selected item
radRichTextBox.Document.Insert(((Products)radListBox.SelectedItem).Name +
": "
, radRichTextBox.Document.Style);
//Get caret position now text has been inserted (end position)
DocumentPosition endPosition =
new
DocumentPosition(
this
.radRichTextBox.Document);
//Adjust position of Intellisense ListBox to new Caret position
AdjustAutoCompletePosition();
//Reload Intellisense ListBox with new items based on previous selection
SetAutoCompleteListBoxItems(((Products)radListBox.SelectedItem).ID);
//Set Custom Annotation
SemanticRangeEnd rangeEnd =
new
SemanticRangeEnd();
SemanticRangeStart rangeStart = (SemanticRangeStart)rangeEnd.CreatePairedStart();
rangeStart.Name =
"SemanticRange "
+ count++;
//Place annotation around newly inserted text - note start & end position
radRichTextBox.Document.InsertCustomAnnotationRange(startPosition, endPosition, rangeStart, rangeEnd);
<
t:Paragraph
>
<
custom1:SemanticRangeStart
AnnotationID
=
"1"
Name
=
"SemanticRange 0"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Appliances: "
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"1"
/>
</
t:Paragraph
>
<
t:Paragraph
>
<
custom1:SemanticRangeStart
AnnotationID
=
"1"
Name
=
"SemanticRange 1"
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"1"
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"2"
Name
=
"SemanticRange 0"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Appliances: "
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"2"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Hob: "
/>
</
t:Paragraph
>
<
t:Paragraph
>
<
custom1:SemanticRangeStart
AnnotationID
=
"2"
Name
=
"SemanticRange 0"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Appliances: "
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"2"
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"1"
Name
=
"SemanticRange 1"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Hob: "
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"1"
/>
</
t:Paragraph
>
Thank you for your time,
Rob
//Get caret position (start)
DocumentPosition startPosition =
this
.radRichTextBox.Document.CaretPosition;
//Insert text into document at caret position - text is from Intellisense ListBox selected item
radRichTextBox.Document.Insert(((Products)radListBox.SelectedItem).Name +
": "
, radRichTextBox.Document.Style);
//Get caret position now text has been inserted (end of text)
DocumentPosition endPosition =
this
.radRichTextBox.Document.CaretPosition;
<
t:Paragraph
>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Appliances: "
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"1"
Name
=
"SemanticRange 0"
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"1"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Hob: "
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"2"
Name
=
"SemanticRange 1"
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"2"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Electric: "
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"3"
Name
=
"SemanticRange 2"
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"3"
/>
<
t:Span
FontFamily
=
"Verdana"
FontSize
=
"16"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Beko HIC64102"
/>
</
t:Paragraph
>
public
override
bool
SkipPositionBefore
{
get
{
return
true
;
}
}
public
override
bool
IsCopyable
{
get
{
return
true
;
}
}
public
override
AnnotationMarkerDeleteBehavior BackspaceBehavior
{
get
{
return
AnnotationMarkerDeleteBehavior.SelectAnnotation;
}
}
public
override
bool
SkipPositionBefore
{
get
{
return
true
;
}
}
public
override
bool
IsCopyable
{
get
{
return
true
;
}
}
public
override
bool
SkipPositionsInRange
{
get
{
return
true
;
}
}
<
t:Paragraph
>
<
custom1:SemanticRangeStart
AnnotationID
=
"1"
Name
=
"SemanticRange 0"
/>
<
t:Span
FontFamily
=
"Segoe UI"
FontSize
=
"14"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Appliances: "
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"1"
/>
<
custom1:SemanticRangeStart
AnnotationID
=
"2"
Name
=
"SemanticRange 1"
/>
<
t:Span
FontFamily
=
"Segoe UI"
FontSize
=
"14"
FontStyle
=
"Normal"
FontWeight
=
"Normal"
Text
=
"Dishwasher"
/>
<
custom1:SemanticRangeEnd
AnnotationID
=
"2"
/>
</
t:Paragraph
>
void
RadSchedViewLoaded(
object
sender, RoutedEventArgs e)
{
var scheduleViewModel = DataContext
as
ScheduleViewModel;
if
(scheduleViewModel !=
null
)
{
scheduleViewModel.RefeshAppointmentSettings();
var groupDescriptionsSource = _radSchedView.GroupDescriptionsSource;
_radSchedView.ClearValue(RadScheduleView.GroupDescriptionsSourceProperty);
_radSchedView.SetValue(RadScheduleView.GroupDescriptionsSourceProperty, groupDescriptionsSource);
}
}