Telerik Forums
UI for WPF Forum
4 answers
888 views

See that over the years there has been many issues with "Index out of range". Is this a general issue that has not been resolved yet? We are starting to use a WPF-application in production and as the load increases we get more and more of these exceptions. Looks like it can happen when we remove and item from a RadObservableCollection (or a ObservableCollection bound to a RadTimeline) and add an item right afterwards. Maybe combined with many entries in the collection.

Is there a workaround?

Here is a callstack:

2017-11-13 16:34:38,704 [106:1] ERROR Tennotech.Hilding.Watchman.App - Unhandled exception: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
2017-11-13 16:34:38,714 [106:1] DEBUG Tennotech.Hilding.Watchman.App - Stacktrace:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at Telerik.Windows.Controls.ProjectedView`1.ObservableSourceListCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CompositeCollection.OnContainedCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Windows.Data.CollectionContainer.OnContainedCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at Tennotech.Hilding.Watchman.Utilities.MirroredRadList`2.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in C:\BuildAgent\work\a6c0493e3d7aa6b\Source\Tennotech.Hilding.Watchman.Utilities\MirroredRadList.cs:line 193
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at Tennotech.Hilding.Watchman.Framework.Devices.GenericRecordingsSynchronizer.OnRecordingsUpdated(Object sender, ParameterizedEventArgs`1 eventArgs) in C:\BuildAgent\work\a6c0493e3d7aa6b\Source\Tennotech.Hilding.Watchman.Framework\Devices\GenericRecordingsSynchronizer.cs:line 174
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Ola
Top achievements
Rank 1
 answered on 16 Nov 2017
9 answers
382 views

Hi,

  There are switches you can use in Word to make the value of a mail merge field change case.  Ex. \* FirstCap, \* Upper, \* lower.  These don't seem to work correctly in the RichTextBox.  I'm adding the fields in code and the values display but the formatting isn't correct.  I've taken a template I made in Word and tried that which works correctly in Word but doesn't in the Telerik control so I'm not sure it is my code that is the issue.

  Any help would be appreciated.

      Troy

Boby
Telerik team
 answered on 16 Nov 2017
4 answers
511 views

Dear Sirs,

I have been working with RadVirtualGrid for WPF and I have found a problem trying to change columns' visibility. I need to do it both from code and from xaml.
I would appreciate any help with it.

I'm working with DataProvider, if this info helps in anyway.

Thanks in advance,

Stefan
Telerik team
 answered on 16 Nov 2017
3 answers
90 views

I manually set the color of a Line Series in xaml as Blue. Now in tooltip I also want the same color.

<telerik:LineSeries x:Name=ser1 ItemsSource="{Binding Data}"
CategoryBinding="Name" Stroke="Blue" ValueBinding="Value">
   <telerik:LineSeries.TooltipTemplate>
        <DataTemplate>
             <SatckPanel>
                <ItemsControls ItemsSource="{Binding}">
                    <ItemsControl.Template>
                        <DataTemplate>
                           <Ellipse Width="12" Height="12" Fill="Blue">
                    ....
                        </DataTemplate>
                     </ItemsControl.Template>
                <ItemsControls>
            </StackPanel>
         </DataTemplate>
    </telerik:LineSeries.TooltipTemplate>
</telerik:LineSeries>

Now my question if we don't use hard code how can we make the colors same?

Trump
Top achievements
Rank 1
 answered on 16 Nov 2017
1 answer
235 views

I've got a TabStripPanel on a RadPaneGroup where sometimes the tabs are only the width of the label and other times they stretch to fill the entirety of the width of the pane. The application is using a pretty dated Telerik version 2014.3.2117.45

 

Any tips about why this sort of behavior could be manifesting? Thanks.

Martin
Telerik team
 answered on 16 Nov 2017
1 answer
177 views

I am using a ObservableGraphSourceBase with a fairly standard Link model and a  HierarchicalNodeViewModel as bases for my Diagram to display.

Within my Diagram declaration in the XAML I am successfully using ShapeStyleSelector property to set the style of my Nodes as they are dropped or read into the diagram.

I am looking for a way to remove and or add Connectors to the Nodes either from the Style via a Setter of some sort or somehow grammatically with a MVVM friendly method.

 

I have tried from within the HierarchicalNodeView model but it does not have access to the resulting shape it seems. Also the ObservableGraphSourceBase does not seem to have access to the resulting RadDiagramShape which houses the Connectors list.

 

Please help.

Petar Mladenov
Telerik team
 answered on 16 Nov 2017
2 answers
309 views

Hi,
I'm using 2017.3.913.45 and I've been trying to focus a NumericUpDown-Control when the user changes the current Tab of a RadTabControl.

So I've got a RadTabControl:

<telerik:RadTabControl ... SelectionChanged="TabControl_SelectionChanged" ...>
    ..
    <telerik:RadTabItem Name="MyTab">
        ..

        <telerik:RadNumericUpDown Name="MyNumericUpDown" ..></telerik:RadNumericUpDown>
         ..

    </telerik:RadTabItem>
    ..
</telerik:RadTabControl>

 

And a TabControl_SelectionChanged Method:

private void TabControl_SelectionChanged(object sender, RadSelectionChangedEventArgs e)
{
    try
    {
        if(e.AddedItems[0] == MyTab)
        {
            MyNumericUpDown.Focus();
            Keyboard.Focus(MyNumericUpDown);
        }
    }
    catch
    {
        System.Diagnostics.Debugger.Break();
    }
}

 

I initially only tried with MyNumericUpDown.Focus() which did not work, a colleague asked me to add the Keyboard.Focus(MyNumericUpDown) call, but that also does not work.

What's the workflow here?

ITC
Top achievements
Rank 1
 answered on 16 Nov 2017
1 answer
144 views

Hi,

How to disable renaming the Telerik Spreadsheet?

Here is the XAML and we are using Telerik 2017.2.614.45.NoXaml

<telerik:RadSpreadsheet
                        x:Name="sprSpecification"
                        Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}"
                        Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight}"
                        ScrollViewer.HorizontalScrollBarVisibility="Auto"
                        ScrollViewer.VerticalScrollBarVisibility="Auto"
                        Workbook="{Binding Workbook, Mode=TwoWay}" />

 
Thanks,
Sri

Anna
Telerik team
 answered on 16 Nov 2017
1 answer
333 views

I use ChartView and BarSeries. I want different bar has different color. I defined six colors. So I defined the palette as below. However it is hard coded. Now I want to change the color by the value at the run time. Say less than 100 use color 1, 100~200 use color 2 etc. Not sure how?

<telerik:ChartPaletette x:key="myPalette">
      <telerik:ChartPalette.GlobalEntries>
            <telerik:PaletteEntry Fill="#FE24C532" />
            <telerik:PaletteEntry Fill="#FE54C5A1" />
            <telerik:PaletteEntry Fill="#FE2AC5D5" />
            <telerik:PaletteEntry Fill="#FE00CF4A" />
            <telerik:PaletteEntry Fill="#FE54A531" />
            <telerik:PaletteEntry Fill="#FE2CC5C1" />
       </telerik:ChartPalette.GlobalEntries>
</telerik:ChartPaletette x:key="myPalette">
Martin Ivanov
Telerik team
 answered on 16 Nov 2017
3 answers
161 views

I just got these Problem on Windows XP.

If any binded value get changed, the PropertyChanged event will throw an exception.

 

XAML-Code:

01.<telerik:RadWindow x:Class="TelerikWpfApp.TelerikScenario"
04.        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
05.        Header="TelerikScenario" Height="300" Width="300">
06.    <Grid>
07.        <Grid.ColumnDefinitions>
08.            <ColumnDefinition />
09.            <ColumnDefinition />
10.        </Grid.ColumnDefinitions>
11. 
12.        <Label Content="{Binding Text, UpdateSourceTrigger=PropertyChanged}" Grid.Column="0" />
13. 
14.        <Button Content="CHANGE VALUE" Click="Button_Click" Grid.Column="1" Height="150" Margin="5" />
15.    </Grid>
16.</telerik:RadWindow>

 

Code Behind:

using System;
using System.ComponentModel;
using System.Windows;
 
namespace TelerikWpfApp
{
    /// <summary>
    /// Interaction logic for TelerikScenario.xaml
    /// </summary>
    public partial class TelerikScenario : INotifyPropertyChanged
    {
        #region Private Fields
        private string text = "test";
        #endregion Private Fields
 
        #region Public Events
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion Public Events
 
        #region Protected Methods
        protected void SetProperty<T>(ref T storage, T value, string property = null)
        {
            if (Object.Equals(storage, value)) return;
            storage = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
        }
        #endregion Protected Methods
 
        #region Public Properties
        public string Text
        {
            get { return text; }
            set { SetProperty(ref text, value); }
        }
        #endregion Public Properties
 
        #region Public Constructors
 
        public TelerikScenario()
        {
            InitializeComponent();
            DataContext = this;
        }
 
        #endregion Public Constructors
 
        #region Private Methods
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Text = "123";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion Private Methods
    }
}

 

Exception:

Cannot change AllowsTransparency after a Window has been shown or
WindowInteropHelper.EnsureHandle has been called.

 

  at System.Windows.Window.CoerceAllowsTransparency(DependencyObject d, Object value)
  at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp,
  PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex,
  EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue,
  Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback,
  Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean
  skipBaseValueChecks)
  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.InvalidateProperty(DependencyProperty dp)
  at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean
  isASubPropertyChange)
  at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean
  isASubPropertyChange)
  at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean
  isASubPropertyChange)
  at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean
  dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
  at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k,
  ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
  at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String
  propName)
  at
  MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type
  managerType, Object sender, EventArgs e)
  at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs
  args, ListenerList list)
  at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object
  sender, PropertyChangedEventArgs args)
  at TelerikWpfApp.TelerikScenario.SetProperty[T](T& storage, T value, String
  property) in C:\Users\BL\Documents\Visual Studio
  2017\Projects\TelerikWpfApp\TelerikWpfApp\TelerikScenario.xaml.cs:line 39
  at TelerikWpfApp.TelerikScenario.set_Text(String value) in
  C:\Users\BL\Documents\Visual Studio
  2017\Projects\TelerikWpfApp\TelerikWpfApp\TelerikScenario.xaml.cs:line 47
  at TelerikWpfApp.TelerikScenario.Button_Click(Object sender, RoutedEventArgs e)
  in C:\Users\BL\Documents\Visual Studio
  2017\Projects\TelerikWpfApp\TelerikWpfApp\TelerikScenario.xaml.cs:line 66

Vladimir Stoyanov
Telerik team
 answered on 15 Nov 2017
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?