Telerik Forums
UI for WPF Forum
1 answer
99 views
I have a RadGridView with a default sort descriptor defined in xaml for my grid.
Wen i run the project, if i press return two times, an exception is trown.

Application: WpfApplication3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
   at System.Collections.Generic.ArraySortHelper`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
   at System.Array.BinarySearch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
   at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
   at Telerik.Windows.Data.KeyedCollection.IndexOf(System.Object)
   at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(System.Object)
   at Telerik.Windows.Data.QueryableCollectionView.IndexOf(System.Object)
   at Telerik.Windows.Data.QueryableCollectionView.Contains(System.Object)
   at Telerik.Windows.Data.DataItemCollection.Contains(System.Object)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CanActivateRowExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
   at System.Windows.Input.CommandBinding.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
   at System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection, System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
   at System.Windows.Input.CommandManager.FindCommandBinding(System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
   at System.Windows.Input.CommandManager.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
   at System.Windows.UIElement.OnCanExecuteThunk(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
   at System.Windows.Input.CanExecuteRoutedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.Input.RoutedCommand.CriticalCanExecuteWrapper(System.Object, System.Windows.IInputElement, Boolean, System.Windows.Input.CanExecuteRoutedEventArgs)
   at System.Windows.Input.RoutedCommand.CanExecuteImpl(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
   at System.Windows.Input.RoutedCommand.CriticalCanExecute(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(System.Windows.Input.KeyEventArgs)
   at System.Windows.UIElement.OnKeyDownThunk(System.Object, System.Windows.Input.KeyEventArgs)
   at System.Windows.Input.KeyEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawKeyboardActions, Int32, Boolean, Boolean, Int32)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(System.Windows.Interop.MSG ByRef, Boolean ByRef)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(System.Windows.Interop.MSG ByRef, System.Windows.Input.ModifierKeys)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(System.Windows.Interop.MSG ByRef, Boolean ByRef)
   at System.Windows.Interop.HwndSource+WeakEventPreprocessMessage.OnPreprocessMessage(System.Windows.Interop.MSG ByRef, Boolean ByRef)
   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at System.Windows.Application.Run()
   at WpfApplication3.App.Main()



the folowing code, reproduces my issue.

<Window x:Class="WpfApplication3.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
<telerik:RadGridView x:Name="grid" ItemsSource="{Binding Itens}">
    <telerik:RadGridView.SortDescriptors>
        <telerik:SortDescriptor Member="Id" SortDirection="Ascending" />
    </telerik:RadGridView.SortDescriptors>
</telerik:RadGridView>
    </Grid>
</Window>

public class Item
{
    public int Id { get; set; }
    public string Name { get; set; }
}
 
public class ViewModel
{
    public ObservableCollection<Item> Itens { get; set; }
 
    public ViewModel()
    {
        this.Itens = new ObservableCollection<Item>();
 
        Itens.Add(new Item() { Name = "teste", Id = 0 });
        Itens.Add(new Item() { Name = "teste 1", Id = 1 });
        Itens.Add(new Item() { Name = "teste 2", Id = 2 });
    }
}
 
public partial class MainWindow : Window
{
    public MainWindow()
    {
        this.DataContext = new ViewModel();
        InitializeComponent();
    }
}
Yordanka
Telerik team
 answered on 09 Aug 2011
2 answers
141 views
User would like to be avoid stopping at a date since it isn't always required.  Setting the IsTabStop to False doesn't work.  Even after setting the IsTabStop property to false, the cursor continues to stop for each part of the date (mm/dd/yyyy).
Bhavesh
Top achievements
Rank 1
 answered on 08 Aug 2011
2 answers
165 views
hi there,

I'm fairly new to Telerik and WPF so I was wondering if someone could help me with a few questions.
My questions are related mainly to RadScheduleView Drag and Drop behavior and also the ability to show a RadContextMenu in a specific area of the radscheduleview control. I have included a sample project and the screenshot below.

1. If I drag a GridViewRow to a schedule view, is it possible to delete that row from my grid after it is dragged to the RadScheduleView ?
2. Is it possible to drag a GridViewRow and drag that row to the GroupHeader and then add a new resource ?
How can I do that?
3. Why does my custom ScheduleViewDragDropBehavior keep calling ConvertDraggedData
even if DragComplete is not actually reached in the OnDragInfo draghandler of my RadGridView ?
4. How can I setup my RadContextMenu to only show up in the GroupHeader to the left (I'm using Timeline View)?
Is it possible to hide ContextMenu when I right click the TimeViewDefinition area ?

SampleProject
AppScreenshot
Elneilo
Top achievements
Rank 1
 answered on 08 Aug 2011
2 answers
129 views
Looking for input on what others do. I've implemented a custom provider. I create a large image in memory and then slice it into tiles. This works until the image is too big and I run out of memory. Surely there is a better way to do this. Ideally I would like something that creates the tiles directly to disk. Another 'problem' is that I'm doing things like 'DrawPolygon' onto my image so I don't have knowledge of exactly which pixels are being colored, otherwise I could easily figure which pixels to write to. Appreciate any help. Thanks.
Jason D
Top achievements
Rank 1
Veteran
 answered on 08 Aug 2011
2 answers
140 views
I want to bind a chart to a table in sql server, is that possible in wpf for windows application?

Thanks in advance
Evgenia
Telerik team
 answered on 08 Aug 2011
1 answer
122 views
When the user adds a new row to the GridView and then cancels the inserting process the event 'RowEditEnded' is called with "e.EditOperationType == Insert" and  "e.EditAction == Cancel".

Is there some way to get the BusinessObject behind the inserted row that was canceled?

e.EditedItem, e.NewData are both null.
Ivan Ivanov
Telerik team
 answered on 08 Aug 2011
7 answers
203 views
Hi,
I am trying to bind a hierachical gridview using entity framework 4.0. (tables: Countries with Districts)
Whenever i try to add a child table definition to the main gridview  the ability to sort the child gridview is lost ( when setting the property relation):
d.Relation = new Telerik.Windows.Data.PropertyRelation("Districts");

If i manually add the datasource then sorting works perfectly. Is this the normal behaviour ? Am i doing something wrong?

GridViewTableDefinition d = new GridViewTableDefinition();
d.DataSource = new SofERPEntities().Districts.Where(z=>z.CountryId==5).ToList();   => sorting in child gridview works
 //d.Relation = new Telerik.Windows.Data.PropertyRelation("Districts");  => sorting in child gridview not working
this.radGridView1.ChildTableDefinitions.Add(d);


Dimitrina
Telerik team
 answered on 08 Aug 2011
1 answer
283 views
I'm trying to write an app where each part of the config is held in a usercontrol.  In moving this to WPF from winforms I thought it would look good to put the config tabbed in a ribbon at the top.

I tried using the ribbonbar but ran into a problem when a tab was selected that contained a usercontrol  I've now got the RibbonView and tried the same thing and run into the same problem.

My code is:

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:WpfApplication1="clr-namespace:WpfApplication1">
    <Grid>
        <telerik:RadRibbonView Name="radRibbonView1" >
            <telerik:RadRibbonTab>
                <WpfApplication1:UserControl1/
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
    </Grid>
</Window>


Where UserControl1 is an empty user control.

When I try to run this, I get the following error:

Specified element is already the logical child of another element. Disconnect it first.

The trace is:

   at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   at System.Windows.FrameworkElement.AddLogicalChild(Object child)
   at System.Windows.Controls.HeaderedContentControl.OnHeaderChanged(Object oldHeader, Object newHeader)
   at System.Windows.Controls.HeaderedContentControl.OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   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.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(DependencyObject container, Object currentObject)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(Object createdObject, DependencyObject& rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
   at System.Windows.FrameworkTemplate.<>c__DisplayClass6.<LoadOptimizedTemplateContent>b__3(Object sender, XamlObjectEventArgs args)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(Object value)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
Viktor Tsvetkov
Telerik team
 answered on 08 Aug 2011
2 answers
159 views
The data renders just fine but the Click event does not fire...

XAML below

<telerikChart:RadChart x:Name="radChartCompanyRevenue" Width="500" Height="350" IsEnabled="True">
    <telerikCharting:ChartDefaultView>
        <telerikCharting:ChartDefaultView.ChartLegend>
            <telerikCharting:ChartLegend Visibility="Collapsed" />
        </telerikCharting:ChartDefaultView.ChartLegend>
        <telerikCharting:ChartDefaultView.ChartArea>
            <telerikCharting:ChartArea ItemClick="ChartArea_ItemClick" />
        </telerikCharting:ChartDefaultView.ChartArea>
    </telerikCharting:ChartDefaultView>
    <telerikChart:RadChart.SeriesMappings>
        <telerikCharting:SeriesMapping>
            <telerikCharting:SeriesMapping.SeriesDefinition>
                <telerikCharting:PieSeriesDefinition>
                </telerikCharting:PieSeriesDefinition>
            </telerikCharting:SeriesMapping.SeriesDefinition>
            <telerikCharting:SeriesMapping.ItemMappings>
                <telerikCharting:ItemMapping DataPointMember="XCategory" FieldName="Month"/>
                <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Revenue"></telerikCharting:ItemMapping>
            </telerikCharting:SeriesMapping.ItemMappings>
        </telerikCharting:SeriesMapping>
    </telerikChart:RadChart.SeriesMappings>
</telerikChart:RadChart>

C# code below

// constructor
public DrillDown_Report()
{
    InitializeComponent();           
    BindCompanyRevenue();
}
private void ChartArea_ItemClick(object sender, Telerik.Windows.Controls.Charting.ChartItemClickEventArgs e)
{
    CompanyRevenue_Event cr = e.DataPoint.DataItem as CompanyRevenue_Event;
    MessageBox.Show(cr.Month + " " + cr.Revenue.ToString());
}
#region Company Revenue
private void BindCompanyRevenue()
{
    radChartCompanyRevenue.ItemsSource = this.GetCompanyRevenue();
    radChartCompanyRevenue.DefaultView.ChartTitle.Content = "Company Revenue";
    radChartCompanyRevenue.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;
    radChartCompanyRevenue.DefaultView.ChartArea.ItemClick += new EventHandler<Telerik.Windows.Controls.Charting.ChartItemClickEventArgs>(ChartArea_ItemClick);
}
private List<CompanyRevenue_Event> GetCompanyRevenue()
{
    List<CompanyRevenue_Event> companyRevenue = new List<CompanyRevenue_Event>();
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Jan", 189213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Feb", 179213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Mar", 180213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Apr", 184213.58));
    return companyRevenue;
}
#endregion

Marcelo
Top achievements
Rank 1
 answered on 08 Aug 2011
2 answers
389 views
Hi,

I using a MVVM environment and try to achieve an auto size of all columns depending on a user preselected mode.
Therefore I've bound the RadGridView.ColumnWidth to a Property in the ViewModel. As I change the value of the property the values of the grid is also changing but the existing Columns are not resized. To force the resize if have iterate to each Column an change the Width.
But is not the best thing to do in an MVVM concept. Is there any better solution for that?

Regards
Thomas
Thomas
Top achievements
Rank 1
 answered on 08 Aug 2011
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
LayoutControl
ProgressBar
Sparkline
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
Callout
Rating
Accessibility
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?