Telerik Forums
UI for WPF Forum
2 answers
86 views
Is there a way to get notified when the user pans the digram? I didn't see an event that looked obvious to me and noticed that the RadDiagram does not implement the INotifyPropertyChanged interface so I can't get notified when the Viewport changes.
Eric
Top achievements
Rank 1
 answered on 04 May 2012
6 answers
849 views
Good evening,

How can I insert text into my RadRichTextBox / Document wrapped with custom annotations?

I have the following code, but it only works the first time the code is run. If I run the code a second time by inserted a second piece of text then the annotations aren't wrapped properly.
Please see my code & XAML output below.

Code to insert text and annotation:
//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);

Here is the XAML output when the code is run for the first time (this is correct as it should be):
<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>

If I run the code a second time to insert a second piece of text then I get the following output (this isn't what I want):
<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>

This is the XAML output that I want to achieve (each piece of inserted text has it's on annotation range):
<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>

I think the problem is that I'm not getting the correct start & end positions of the newly inserted text. Please see my c# code "positionStart" & "positionEnd".

Basically my application is an intellisense autocomplete application where the ListBox autcomplete items are drawn from a database. Thus I need the custom annotations to wrap around my text to relate it to the database ID tags. I haven't setup the proper annotation values yet, I'm just playing with the example code from a telerik demo project.

Any advice would be greatly appreciated.

I think I need to achieve the following:
  • Get Caret Position (start position)
  • Insert text into document
  • Get Carent Position (end position)
  • Apply annotation based on start & end positions

 

Thank you for your time,

Rob


************   EDIT   *************

I have tried setting the start and end positions like so but it still doesn't work:

C# Code to insert text & annotations:
//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;


XAML Output:
<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>




Robert
Top achievements
Rank 1
 answered on 04 May 2012
1 answer
146 views
Good evening,

Is there a list or information detailing what properties & methods can be overridden and the function they serve for the Annotation Ranges ?

For example I have SmanticRangeStart & SemanticRangeEnd classed with the following properties:

Range End
public override bool SkipPositionBefore
{
    get
    {
        return true;
    }
}
 
public override bool IsCopyable
{
    get
    {
        return true;
    }
}
 
public override AnnotationMarkerDeleteBehavior BackspaceBehavior
{
    get
    {
        return AnnotationMarkerDeleteBehavior.SelectAnnotation;
    }
}

Range Start
public override bool SkipPositionBefore
{
    get
    {
        return true;
    }
}
 
public override bool IsCopyable
{
    get
    {
        return true;
    }
}
 
public override bool SkipPositionsInRange
{
    get
    {
        return true;
    }
}

Any information would be very useful.

Thanks,

Rob



Iva Toteva
Telerik team
 answered on 04 May 2012
2 answers
181 views
Hi,

How do you get the custom annotation of a selected span?

For example:
<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>

Suppose my select range covers the last span which contains the text "Dishwasher".
From the selection, how can I retrieve it's annotation programmatically?

Thank you for your time,

Rob
Robert
Top achievements
Rank 1
 answered on 04 May 2012
3 answers
91 views
Hi,

I use Telerik V2011.3.1220.35 and in my application I have multiple radgridview in multiple radwindow. I don't know why but with some radgridview, I have a problem when I try to use the filter icon in the columns headers. For those radgridview who I have problems with, when I click on the filter icon in columns header, a filters dialog appear, in the filter dialog, I can see a list of values that I can select or unselect without any problem but when I try to use the textbox to enter a value manually, the only char the textbox accept is the space!!!

I tried to compare one of my working radgridview with another one which is not working without any succes :(

PS: Each RadGridView are build dynamically at runtime, ie: Columns, Grouping, Sortings, etc...

Can you point me into a direction that I can check?

Thank's
Oliver
Top achievements
Rank 1
 answered on 04 May 2012
1 answer
146 views
Hi,

is it possible to disable the "edit series" (recurrence) in the Appointment Dialog? Thank'S a lot

Best regards
Rene
Annett
Top achievements
Rank 1
 answered on 04 May 2012
1 answer
104 views
Based on the example of the Demo Telerik SchedulerView (see included image).
I want to have grouping which will show different resources on every day.
Please guidance or code.

Annett
Top achievements
Rank 1
 answered on 04 May 2012
1 answer
99 views
Hi,

I add and remove some resources. That works fine. If i navigate to my scheduleview (its on a different tabitem) the added resources wouldn't be shown.
I try these solution http://www.telerik.com/community/forums/wpf/scheduleview/how-to-refresh-scheduleview-when-clearing-and-re-adding-to-resourcetype-resources.aspx and it works.
I do this on the ScheduleViewLoaded event. This is fired if i changed the tabitem.
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);
 
    }
}

But somehow it crashes my style. See in my added picutres. The rows are greater after adding (afteraddingresource.jpg) and if i navigate the week up and down (afteraddingresourceandchangingvisibiblerange.jpg) it looks correct again.

What can i do? Can i set for example somehow the resource.MaxHeight?

Thanks
Annett
Annett
Top achievements
Rank 1
 answered on 04 May 2012
2 answers
107 views
Hi,

I have multi-level nested grid view and all the nested grids are expanded by default.
When i sort the first level items, all the child/nested levels are collapsed.
Is there any way to retain the expanded mode for all the child levels after sorting?

Thanks
Thangalskhmi
Top achievements
Rank 1
 answered on 04 May 2012
3 answers
631 views
I am setting the Font and Font color of a RadRichTextBox via the FontFamily and Foreground properties which are bound to properties on a ViewModel. This works quite well when I have the Text property bound to a property on a ViewModel, but when I instead use an HtmlDataProvider to provide the text to the RadRichTextBox, setting the Foreground and FontFamily properties no longer has any effect. 

Is there a way to set the Font and Font color via databinding to either the textbox or the dataprovider or will I have to change the Html to specify the font and color?
Iva Toteva
Telerik team
 answered on 04 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?