Telerik Forums
UI for WPF Forum
3 answers
472 views
Hello, sorry if this is posted in the wrong section of the forum.

Now, my question is simple.
I want to find and replace text(strings) in a document, I've tried using the following code:

private void ReplaceAllMatches(RadDocument document, string toSearch, string toReplaceWith)
{
       DocumentTextSearch search = new DocumentTextSearch(document);
       List<TextRange> rangesTrackingDocumentChanges = new List<TextRange>();
       foreach (var textRange in search.FindAll(toSearch))
       {
                TextRange newRange = new TextRange(new DocumentPosition(textRange.StartPosition, true),
                new documentPosition(textRange.EndPosition, true));
                rangesTrackingDocumentChanges.Add(newRange);
            }
 
            RadDocumentEditor docEdit = new RadDocumentEditor(document);
            foreach (var textRange in rangesTrackingDocumentChanges)
            {
                document.CaretPosition.MoveToPosition(textRange.StartPosition);               
                document.DeleteRange(textRange.StartPosition, textRange.EndPosition);
                 
                StyleDefinition style = new StyleDefinition();
                style.SetPropertyValue(Span.ForeColorProperty, Colors.Red);
                                               
                document.Insert(toReplaceWith, style);
 
                textRange.StartPosition.Dispose();
                textRange.EndPosition.Dispose();
            }
        }

But I get two errors, "document.DeleteRange() is obsolete use RadDocumentEditor.Delete() instead." and "document.Insert() is obsolete use RadDocumentEditor.InsertInline() instead.".
I can't figure out how to use these functions instead so that's why I need help!

I've never used this library before so all help is very appreciated.
Best regards
Isak
Petya
Telerik team
 answered on 03 Sep 2014
7 answers
911 views
Hello,

i tried to get the text in RichTextBox with Binding with a property of my ViewModel with type 'string'.
But
something with binding is always wrong. I couldn't pass a defined
string from ViewModel, and i got always string.empty from RichTextBox.

Here is my code in xaml, i also tried RadWatermarkTextBox, that works fine.
<telerik:XamlDataProvider RichTextBox="{Binding ElementName=richTextBox1}" Xaml="{Binding PropertyName, Mode=TwoWay}" />
<telerik:RadRichTextBox Name="radRichTextBox"/>
 
<telerik:RadWatermarkTextBox Text="{Binding Path=PropertyName, Mode=TwoWay}"/>

I have seen some articals with using selection. But i don't want to use it instead of lovely binding...
Another try i have done is with TextRange
var startPosition = new DocumentPosition(radRichTextBox.Document.CaretPosition);
var endPosition = new DocumentPosition(radRichTextBox.Document.CaretPosition);
startPosition.MoveToFirstPositionInDocument();
endPosition.MoveToLastPositionInDocument();
 
var text = new TextRange(
           // TextPointer to the start of content in the RichTextBox.
           startPosition,
           // TextPointer to the end of content in the RichTextBox.
           endPosition).Text;
But Telerik TextRange has difference of MS TextRange, it has no property Text...

Is there a easy way to implement that? That could not be so hard, right? Or what i did wrong in my code?
Petya
Telerik team
 answered on 03 Sep 2014
3 answers
180 views
Is it possible to get hold of the Office2013Palette.Palette.AccentMainColor in XAML?

I know you can get hold of the brushes, using something such as
      telerik:Office2013Resource ResourceKey=EffectAccentHighBrush

however, I need to assign to a color property in the XAML. For the Windows 8 theme, I would use something along the lines of 
      Color="{Binding Source={StaticResource Windows8Colors}, Path=Palette.MainColor}"

Is there a way to get the similar value for the Office2013 theme? 

Thanks
Jason
Vanya Pavlova
Telerik team
 answered on 03 Sep 2014
3 answers
321 views
Hello,

I want to implement drag n drop functionality from RadGridView to RadTreeView. I dont want to use ViewModel.

in the RadGridView i have some data pulled from Database , i.e a list of songs with their tags as columns.

In the treeview i have made some categories of songs. I want to drag a song / or multiple songs from RadGridView and drop it on a category node of treeview. internally i will get a list of all selected rows of grid which or dragged on the Drop Event of treeview and update it to my collection and later in DB. I looked in your demos but all are using MVVM. I want a pure C# code , which would implement my task ASAP.
Yana
Telerik team
 answered on 03 Sep 2014
3 answers
203 views
Hi,

I've app with default theme and I would like to know if it is possible to use Windows8Theme scrollview for my gridview. And I also  need to perform some customization for example I need to change thumb color, remove up/down repeatbuttons.  Thanks in advance for any help.
Vanya Pavlova
Telerik team
 answered on 03 Sep 2014
1 answer
187 views
I have a GridView which contains a name column - and the name may be null or " " or "" or a real name.

Ex:
Name1: null
Name2: " "
Name3: ""
Name4: "Obama"
Name5: "obama"
Name6: " obama" (should be grouped with Obama and not with "")

In the group header I would like to group by the names first letter - or "" if there String.IsNullOrWhiteSpace is true. And I would like the group header to ignore the case of the first letter.
There are other columns in the GridView which I do not want grouped like this.

I have done this:
 GroupMemberPath="Entity.Name[0]"

But that leaves an ugly square in the header if the name is null - (and " " and "" are grouped in two different groups. So is "Obama" and "obama" and " obama").

I have a quite a few of these name-columns around in my program, so I would like an elegant, reusable solution :ø) What I really need is a way to add a Converter to the group binding.

Normally I would use a converter, but there does not seem to be a way to add a converter to the groupmemberpath (?)
There is a GroupHeaderFormatString; but I have failed to find a way to get {}{0:<something>} to return the first letter.
The type of Name is String. I really do not want to change this so adding a FirstLetter-property is not a solution either.
Seems like adding a GroupHeaderTempate will only affect the text in the group header. It will not allow me to group "Obama" and "obama" in the same group.

Is there a solution to this?
Thanks


Dimitrina
Telerik team
 answered on 02 Sep 2014
7 answers
223 views
Hi,

I try to follow the thread about CustomStyle (http://www.telerik.com/help/wpf/styling-apperance-custom-styles-themes-runtime.html) by replacing the RadButton by a RadGridView.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="telerik:RadGridView" BasedOn="{StaticResource RadGridViewStyle}">
        <Setter Property="Background" Value="Red"/>
    </Style>
</ResourceDictionary>

When I click on Button to switch the theme, an exception is raised ('System.Windows.Markup.XamlParseException') because it's not able to resolve the RadGridViewStyle. It seems that it can not resolve staticresource presents in another files (app.xaml), i don't understand why it's work with RadButton and not RadGridView.

Thanks for feedback.
Regards
Dimitrina
Telerik team
 answered on 02 Sep 2014
1 answer
167 views
I have a GridView whose ItemsSource is bound to an ICollectionView. This GridView has a child GridView whose ItemsSource is bound to a property of currently selected item of the main GridView.

This all works fine, however, when ever ICollectionView of the main GridView is refreshed the child GridView is also refreshed so it loses it current scroll position and item selection.

Any ideas on how to prevent the child GridView from refreshing when main GridView ItemsSource is refreshed?
Boris
Telerik team
 answered on 02 Sep 2014
3 answers
102 views
By default the DataContext of a child GridView is the selected item of the parent GridView. How would I change this so that the DataContext of the child GridView is the ViewModel of the containing UserControl which is also the DataContext of the parent GridView?

It is important to note that this VM is dynamically instantiated in code and not in XAML of the UserControl because this UserControl is one of several UserContorls which are used as dynamic Content of an area of a parent Window.
Dimitrina
Telerik team
 answered on 02 Sep 2014
2 answers
189 views
Hello,
I'm using the RadRichTextRibbonUI in my application and it seems that resources are missing.
I'm not able to get a German RadRichTextRibbonUI even if I set the languages of my XAML on "de-DE".


Best regards.










Petya
Telerik team
 answered on 02 Sep 2014
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
FileDialogs
Book
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
SplashScreen
Rating
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?