Telerik Forums
UI for WPF Forum
1 answer
132 views
I have modified some code so that you can get the Next & Previous Annotations ONLY if they exist on the same line as the caret.


Get Previous Same Line Annotation:
public static T GetPreviousSameLineAnnotationRangeStart<T>(this RadDocument document) where T : AnnotationRangeStart
{
    //Document caret position
    DocumentPosition caretPosition = new DocumentPosition(document.CaretPosition);
    //Caret Line Info
    ParagraphLineInfo caretLineInfo = caretPosition.GetCurrentInlineBox().LineInfo;
 
    //Next Annotation LineInfo variable
    ParagraphLineInfo previousAnnotationLineInfo = null;
 
 
    if (!document.Selection.IsEmpty)
    {
        document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.StartPosition);
    }
 
 
    InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox();
    do
    {
        inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetPreviousElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox));
    }
    while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeStart));
 
 
    if (inlineLayoutBox == null)
    {
        return null;
    }
    else
    {
        //Get next annotation lineinfo if next annotation exists
        previousAnnotationLineInfo = inlineLayoutBox.LineInfo;
    }
 
 
    //Compare caret & next annotation lines
    if (previousAnnotationLineInfo != caretLineInfo)
    {
        return null;
    }
 
 
    return inlineLayoutBox.AssociatedInline as T;
}

Get Next Same Line Custom Annotation:
public static T GetNextSameLineAnnotationRangeStart<T>(this RadDocument document) where T : AnnotationRangeStart
{
    //Document caret position
    DocumentPosition caretPosition = new DocumentPosition(document.CaretPosition);
 
    //Caret Line Info
    ParagraphLineInfo caretLineInfo = caretPosition.GetCurrentInlineBox().LineInfo;
 
    //Next Annotation LineInfo variable
    ParagraphLineInfo nextAnnotationLineInfo = null;
 
     
 
    if (!document.Selection.IsEmpty)
    {
        document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.EndPosition);
    }
 
    InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox();
    while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeStart))
    {
        inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetNextElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox));
    }
 
 
    if (inlineLayoutBox == null)
    {
        return null;
    }
    else
    {
        //Get next annotation lineinfo if next annotation exists
        nextAnnotationLineInfo = inlineLayoutBox.LineInfo;
    }
 
 
    T annotationRangeStart = inlineLayoutBox.AssociatedInline as T;
    if (annotationRangeStart == null)
    {
        return null;
    }
 
    //Compare caret & next annotation lines
    if (nextAnnotationLineInfo != caretLineInfo)
    {
        return null;
    }
 
    return annotationRangeStart;
}


Here are some examples on how you can use these (note that the Get Next & Previous methods above are in a class file named RadDocumentExtensions. Change this to whatever your class name is):

Previous Same Line Annotation (change the last message box details to suit your custom annotation properties):
SemanticRangeStart sameLinePreviousAnnotation = RadDocumentExtensions.GetPreviousSameLineAnnotationRangeStart<SemanticRangeStart>(this.radRichTextBox.Document);
 
if (sameLinePreviousAnnotation == null)
{
    MessageBox.Show("No previous annotations");
}
else
{
    MessageBox.Show("Name: " + sameLinePreviousAnnotation.Product.Name.ToString() + "\n\nHas Child: " + sameLinePreviousAnnotation.Product.HasChild.ToString());
}


Next Same Line Annotation (change the last message box details to suit your custom annotation properties):

SemanticRangeStart sameLineNextAnnotation = RadDocumentExtensions.GetNextSameLineAnnotationRangeStart<SemanticRangeStart>(this.radRichTextBox.Document);
 
if (sameLineNextAnnotation == null)
{
    MessageBox.Show("No next annotations");
}
else
{
    MessageBox.Show("Name: " + sameLineNextAnnotation.Product.Name.ToString() + "\n\nHas Child: " + sameLineNextAnnotation.Product.HasChild.ToString());
}



Thought I should share this with everyone. There's no point all of us trying to do the same job twice!

Thanks,

Rob
Ivailo Karamanolev
Telerik team
 answered on 11 May 2012
1 answer
181 views
I want to display a tooltip for data points on the selectionPreview area on the TimeBar when the user does a mouseover on a RadColumnSparkline within a RadTimeBar.  Is there a way to do this, as the selectionThumbPreview on the RadTimeBar is displayed in this area? 
Tsvetie
Telerik team
 answered on 11 May 2012
1 answer
115 views
Hi ,
i am new to WPF and Telerik Controls , so obvious answers are also appreciated . 
i need  to implement RadGridView as a custom resuseable control  as per client's requirements .i have created a radgridview in a wpf application with columns and their relevent bindings but client wants it as a custom control which when dragged to wpf window contains all columns by default and by just setting DataContext of the control will populate all the columns with data.
please guide me towards this implementation.
thanks               
Nick
Telerik team
 answered on 11 May 2012
3 answers
114 views
Hi,

i want to set the Startup color from white to a different one. This color i want to set by code (c#).
I tried this:

Color kdcol = ITA_CRM.Klassen.helper.HexColor("#FF008062");
// kdcol = "#FF008062"
this.KundenColorRCE.SelectedColor = kdcol;
this.KundenColorRCE.InitialColor = kdcol;

But in the form it is still white! Why?

Thanks a lot
Regards
Rene
Petar Mladenov
Telerik team
 answered on 11 May 2012
3 answers
126 views
Hi, 


I've recently started using Telerik WPF controls so bare with me when I try to explain my problem.  First thing I have tried to do was to create a dynamic layout docking application.  As shown in number of tutorials, I have created a simple WPF application with RadDocumentHost and another UI class that looks like this: 


<telerik:RadDocumentPane x:Class="RadControlsWpfApp1.RadControlsScenario1"<br>        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br>        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br><span class="Apple-tab-span" style="white-space:pre">       </span>xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"<br>        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"<br>        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"<br>        Header="RadControlsScenario1" mc:Ignorable="d" d:DesignHeight="288" d:DesignWidth="290"><br>    <Grid><br>        <TextBlock Text="Blah blah blah"/><br>    </Grid><br></telerik:RadDocumentPane>



When I try to look at the xaml for this window in VS designers, all I get is a large grey box that covers the entire area.  At that point I can't drag/drop any new controls onto the window.  


Also, in another application that I have converted to use RadDocumentPane, I get very large header tabs at runtime ( about half of the client space is covered by the header tab ).


Has anyone seen this too?  Any help would be greatly appriciated.


Btw, I'm running latest version of the WPF toolkit ( 2012.1.326.40 )
Yana
Telerik team
 answered on 11 May 2012
1 answer
121 views
Hi,

I'm evaluating Telerik Radcontrols for WPF to see how easy it is get done everything UX guys can think of. Now I have the following case in my hands:

I need to have an extending menu that has default mode of showing 30px column of icons by default. End user can click on a button to make the menu expand, showing icons and text. I suppose this can be done with expander quite easily.

The thing is that the expander needs to be placed inside a split container, and the split container needs to expand with the expander, quite as smoothly. In practice, I guess I would have to animate the split container, in sync with the expander animation. Is there an easy way to do this?

Br,

:^Panu>
Viktor Tsvetkov
Telerik team
 answered on 11 May 2012
5 answers
220 views
In our project, we have to achieve the "zebra" effect for the rows of the grid. This effect means that odd rows are one color (e.g. Red) and the even rows are other color (e.g. Blue). For WinForms I found the solution (http://www.telerik.com/community/forums/winforms/themes-and-visual-style-builder/radgridview-row-color.aspx) but I think for WPF it cannot be done in the same way, because EnableAlternatingRowColor  is missing. Can you give me a solution?

Best Regards,
Lazar Sestrimski

LaZeTo
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
198 views

How does one grab the binding in order to force an update on a RadComboBox control?

MyRadComboBox.ItemsSource = MyObservableCollectionOfACustomClass;
MyRadComboBox.DisplayMemberPath = "Description";



Then, I try to grab the binding in a different control's event.

var binding = BindingOperations.GetBindingExpression(MyRadComboBox, RadComboBox.ItemsSourceProperty);

 

if (binding == null) return;  // This is always null

 

binding.UpdateTarget();

Georgi
Telerik team
 answered on 11 May 2012
1 answer
136 views
Hello,

how can i use KeyGestures from the RoutedUICommands with RadMenuItems?

best regards
Ivo
Telerik team
 answered on 10 May 2012
1 answer
129 views
When I persist a control in WPF, should I be able to unpersist it into Silverlight?

I expect the answer to be "it depends".  What controls are cross-compatible; if any?

Also, do you have an example where a control is persisted to XML then re-hydrated back to the control?

Thanks in advance for your help.
Petar Mladenov
Telerik team
 answered on 10 May 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?