Telerik Forums
UI for WPF Forum
1 answer
332 views

Hi,

I am looking to insert an InlineUIContainer by drag/drop of something into the RichTextBox but following dropping of the element, unless it is simple text being inserted I am struggling to work out how to insert an InlineUIContainer at the current cursor location.

 I have managed to insert the control but only to the end of the document.

 A code snippet below might help but errors not at point of insert but when it is trying to update the screen next... The code is taken from the drop handler event.

 

                    Dim point = args.GetPosition(richTextBox)
                    Dim pos = richTextBox.ActiveEditorPresenter.GetDocumentPositionFromViewPoint(point)

                    Dim container As New InlineUIContainer()
                    container.UiElement = New CheckBox() With {.Content = "Testing"}
                    container.Height = 25
                    container.Width = 70
                    ctype(pos.GetCurrentInline().Parent,Paragraph).Inlines.Add(container)

Kind regards,

 

Neil

 

Petya
Telerik team
 answered on 15 May 2015
3 answers
120 views
I work on a WPF application and face with the following issue: When someone who uses our application encounters an exception, we log it to our DB, including the stack trace of the exception. I've encountered an exception with the following stack trace:

System.ArgumentOutOfRangeException: index and length must refer to a location within the string.
Parameter Name: length
at- System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at- Telerik.Windows.Controls.MilitaryDateParser.TryParseSingleDigitDatePart(DateTime& result, DateTime current, String datePart, DayMonthYearIndecesInfo dateIndeces)
at- Telerik.Windows.Controls.MilitaryDateParser.TryParse(String value, DateTime& result, DateTime current)
at- Telerik.Windows.Controls.CompositeDateTimeParser.TryParse(String value, DateTime& result, DateTime current)
at- Telerik.Windows.Controls.RadDateTimePicker.ParseDateTime(String text, IDateTimeParser parser, Nullable`1& dateTime)
at- Telerik.Windows.Controls.RadDateTimePicker.OnDateTimeTextChanged()
at- System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at- System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at- System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at- System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at- System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at- System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at- System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at- System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at- System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at- System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at- System.Windows.Input.InputManager.ProcessStagingArea()
at- System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at- System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at- System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at- System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at- System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at- System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at- MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

The stack trace does not include anything that apply to a line from my application. I understand that something goes wrong with the input given to RadDateTimePicker and it's parsing during OnDateTimeTextChanged().

I want to find out what is the input that fails and also log it, so that next time something goes wrong, I will know the cause.How can I catch the exception, log the input and of course rethrow it?

Basically, in my code, I wrap the RadDateTimePicker with my own control, and bind to its DateTimeTextProperty:

BindingOperations.SetBinding(_radDateTimePicker, RadDateTimePicker.DateTimeTextProperty,
new Binding("DateTimeText")
{
Source = this,
Mode = BindingMode.TwoWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
});

I can listen to _radDateTimePicker events, for example: _radDateTimePicker.ParseDateTimeValue += OnRadDateTimePickerParseDateTimeValue;
Any suggestions, Please?

I just want to know the input the causes the error, and do something like that in the correct location in code:Try
{
}
Catch (ArgumentOutOfRangeException ex)
{
Throw new ArgumentException(String.Format("The input was {0}", input), ex)
}

Maybe I should put this code within some event of _radDateTimePicker that I listen to.Thanks!
Nasko
Telerik team
 answered on 15 May 2015
2 answers
530 views

Hey,i try to display to also display the miliseconds in the DateTime Picker. I changed the format like so:

dpDate.DisplayFormat = Telerik.Windows.Controls.DateTimePickerFormat.Short;
dpDate.Culture = new System.Globalization.CultureInfo(CultureInfo.CurrentUICulture.LCID);
dpDate.Culture.DateTimeFormat.ShortTimePattern = "HH:mm:ss fff";

As soon as I manually change the time in the textbox for example to 13.05.2015 09:57:40 200 and hit return, the selected datetime & textbox text will reset to 13.05.2015 09:57:40 000. What am I doing wrong? ​

Kalin
Telerik team
 answered on 15 May 2015
2 answers
309 views
I am using Telerik RadCartesianchart and I have a requirement where I need to show 2 more horizontal lines along with the X Axis, These lines are for alarms limits so that we can somehow display what is the low and high alarm limits we have for Y Axis data. Is there any way we can do that?
Amit
Top achievements
Rank 1
 answered on 14 May 2015
1 answer
110 views

Hi,

We are trying to populate the parent / child data in hierarchical gridview at runtime. Columns of the grid view is based on the login user. So, we are not set the columns at design.

We use parent - child relationship as below code logic. We can see the parent details and child details. However, for child details, it is showing all information. It should be shown the data which is associated with the parent data.

  <commonData:ExtendedGridView x:Name="HierarchicalGridView1"  
                                             Grid.Column="0" Margin="55,27,0,10" Grid.ColumnSpan="2"
                                             CanUserReorderColumns="False" AutoGenerateColumns="False"   
                                             ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"       
                                             ItemsSource="{Binding Source={StaticResource CollectionVM},Path=ParentCollection}"
                                             commonData:GridViewBindingBehavior.ColumnsCollection="{Binding Source={StaticResource CollectionVM},Path=DynParentColumns}"
                                             >
                            <telerik:RadGridView.ChildTableDefinitions >
                                <telerik:GridViewTableDefinition  >

                                    <telerik:GridViewTableDefinition.Relation>
                                        <telerik:TableRelation IsSelfReference="False">
                                            <telerik:TableRelation.FieldNames>
                                                <telerik:FieldDescriptorNamePair
                     ParentFieldDescriptorName="ORDNO"
                     ChildFieldDescriptorName="ORDNO" />
                                            </telerik:TableRelation.FieldNames>
                                        </telerik:TableRelation>
                                    </telerik:GridViewTableDefinition.Relation>
                                </telerik:GridViewTableDefinition>
                            </telerik:RadGridView.ChildTableDefinitions>


                            <telerik:RadGridView.HierarchyChildTemplate >
                                <DataTemplate>
                                    <commonData:ExtendedGridView ShowColumnHeaders="False" ItemsSource="{Binding Source={StaticResource CollectionVM},Path=ChildCollection}" AutoGenerateColumns="False"  ShowGroupPanel="False"
                                                         commonData:GridViewBindingBehavior.ColumnsCollection="{Binding Source={StaticResource CollectionVM},Path=DynParentColumns}" >
                                    </commonData:ExtendedGridView>
                                </DataTemplate>
                            </telerik:RadGridView.HierarchyChildTemplate>

Your help is much appreciated.

Thanks

VG

 

Dimitrina
Telerik team
 answered on 14 May 2015
6 answers
133 views

Hello,

1. When the Combobox receives the focus with a table, nothing appears with the OnLostFocus method and the LostFocus event.
Correct.

2. When the ComboBox is clicked with the mouse the OnLostFocus method is called and then the LostFocus event is raised.
Error: these should not be called.

3. When the ComboBox loses the focus, the LostFocus event is raised, but the OnLostFocus method is not called.
Error: the OnLostFocus method should be called.

Normally, this OnLostFocus method should fire the LostFocus event. It seems to be bypassed in position 3.

Geri
Telerik team
 answered on 14 May 2015
5 answers
189 views
Is there a way the RadScheduleView can be export to excel?
Kalin
Telerik team
 answered on 14 May 2015
7 answers
329 views
I have case in my code where I use VirtualQueryableCollectionView bind to RadGridView. I want to after VirtualQueryableCollectionView load records from query map to other objects. Something like that:

using (var workRepo = new WorkRepository())
{
    IQueryable<WorkViewModel> works = workRepo.All<Work>().OrderBy("Title").Select(work => new WorkViewModel(work));
    virtualCollection = new VirtualQueryableCollectionView(works) { LoadSize = 50 };
}

This will allow me to bind to WorkViewModel which contains extra logic. But constructor throws exception:

System.NotSupportedException was caught
  HResult=-2146233067
  Message=Only parameterless constructors and initializers are supported in LINQ to Entities.
  Source=EntityFramework
  StackTrace:
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.NewTranslator.TypedTranslate(ExpressionConverter parent, NewExpression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateSet(Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.AggregateTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
       w System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.Convert()
       w System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
       w System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
       w System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
       w System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
       w System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
       w System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
       w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)
       w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
       w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
       w System.Data.Entity.Internal.Linq.DbQueryProvider.Execute(Expression expression)
       w Telerik.Windows.Data.QueryableExtensions.Count(IQueryable source)
       w Telerik.Windows.Data.VirtualQueryableCollectionView..ctor(IEnumerable source, Type itemType)
       w Telerik.Windows.Data.VirtualQueryableCollectionView..ctor(IEnumerable source)
       w Xplus.RNX.WpfClient.UI.ViewModels.MainViewModel.FillCollections() w d:\Users\ppiechnik\Documents\Visual Studio 2012\Projects\RNX\Xplus.RNX\Xplus.RNX.WpfClient\UI\ViewModels\MainViewModel.cs:wiersz 743
  InnerException:

Are there any possibilities to force VirtualQueryableCollectionView to map loaded objects to other objects.
Dimitrina
Telerik team
 answered on 14 May 2015
12 answers
201 views

I'm trying to figure out how to deal with terribly poor performances of my application during pan operations.

Basically when the user starts panning a diagram the CPU goes 100%. Things seems getting worse when the navigation pane is visible.

 

Profiling the application, it seems that the issue is caused by RadDiagram calling the BackgroundLineBase.PrepareLine method thousand times.

Strangely enough I've managed to reproduce the issue in this project from your sample codebase:

  • open the application
  • drag some shapes on the diagram 
  • start panning (at least a second or two)
  •  => the CPU goes 100%​

 

 Can you provide some advice on how to mitigate / fix the issue?

Petar Mladenov
Telerik team
 answered on 14 May 2015
2 answers
863 views

Hi,

 Is there a way to show a tooltip with the value of the slider of the current position of the mouse over the track? So the user know the value is going to select beforehand.

Thanks, Jose

Jose
Top achievements
Rank 1
 answered on 13 May 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?