Telerik Forums
UI for WPF Forum
17 answers
729 views
Hi,

One of our customers is experiencing crashes on a Windows 2003. We've collected a stack trace that is pasted below. It appears there are two issues here:
1. The stack trace below, with its NullPointerException.
2. When the application crashes, the Windows Event Log shows a .NET crash due to a stack overflow. When looking at the stack trace below it appears it may also be related to the stack overflow crash (given how many loops of functions there are in the stack).

Is this crash a result of something we're doing wrong, or a bug in the code?

System.NullReferenceException: Object reference not set to an instance of an object.   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.Remove(GeneratorPosition position, Int32 count, Boolean isRecycling)   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.Controls.Primitives.IRecyclingItemContainerGenerator.Recycle(GeneratorPosition position, Int32 count)   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.CleanupRange(IList children, IItemContainerGenerator generator, Int32 startIndex, Int32 count)   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.CleanupContainers(Int32 firstViewport, BaseItemsControl itemsControl)   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at Telerik.Windows.Controls.RadTabControl.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at Telerik.Windows.Controls.ProportionalStackPanel.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at Telerik.Windows.Controls.DockingPanel.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at Telerik.Windows.Controls.RadDocking.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Canvas.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Window.MeasureOverrideHelper(Size constraint)   at System.Windows.Window.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.ContextLayoutManager.UpdateLayout()   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)   at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)   at System.Windows.Interop.HwndTarget.OnResize()   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)   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)
Thanks,
yonadav

Rossen Hristov
Telerik team
 answered on 14 Jun 2012
1 answer
164 views
Hi Support,
   I'm working on a touch screen app which requires cropping to be implemented. Can u help me out how to handle the events there & to make the drag corners bigger in size.


Thank u
Selva
Iva Toteva
Telerik team
 answered on 14 Jun 2012
3 answers
238 views

Hi Telerik,

I'm currently trying to achieve functionality similar to the trackball behavior, but I actually need to display a horizontal line, that crosses the given ScatterLineSeries  and starts at the corresponding vertical axis. I have to draw a slider on that axis, so I will be able to move this line by moving the slider along the axis (I've attached an image to explain what I mean).

The problem is I can't determine the position of the vertical axis during runtime to place the slider on the correct location.

I can draw the horizontal line and intersection points using another ScatterLineSeries (as was done to create an attached image), but the series cannot be drawn outside the ChartArea, so I have to extend the line to an axis programmatically.

So, is it possible to get the Y-axis coordinates inside the ChartView, or is there another way to implement the described scenario?

Thanks in advance.

Petar Marchev
Telerik team
 answered on 14 Jun 2012
1 answer
122 views
In my application the ItemsSource for the listbox will change depeding on other entity values. I am using CollectionViewSource with changing filter to implement this.

However, the SelectedItem binding is lost in this case. WPF standard ListBox on the other hand behaves correctly. You can download demo application here: http://jemerald.com/myfiles/ListBoxWithFilterSource.rar
Georgi
Telerik team
 answered on 14 Jun 2012
2 answers
133 views
Hi,
I need to show a custom appointment with some custom fields, I followed docs samples but it doesn't work.

My steps:
1) create an AppointmentExt class that inherits from Appointment, with 2 simple extra fields
public class AppointmentExt : Appointment
{
    public planning_slot Slot { get; set; }
    public string SpecialTooltip { get; set; }
}

2) added an ObservableCollection<AppointmentExt> as Appointments source
ObservableCollection<AppointmentExt> appointments = new ObservableCollection<AppointmentExt>();

3) Created a new Tooltip template and bind the text to my specialtooltip
<DataTemplate x:Key="ScheduleTooltip">
    <StackPanel Orientation="Horizontal">
        <TextBlock MaxWidth="200" TextWrapping="Wrap" Text="{Binding SpecialTooltip}"/>
    </StackPanel>
</DataTemplate>

At runtime the SpecialTooltip is fill but it's displayed empty (not binded?).

So I've 2 question:
A) how can I bind the tooltip to my SpecialTooltip field?
B) how can I change the way the appointment is draw ?

Thanks


Yana
Telerik team
 answered on 14 Jun 2012
1 answer
155 views
We are creating a linear gauge, it needs to show some extra markers (on-demand based on user's setting, binding to "Markers").
We tried to add <telerik:LinearScale.CustomItems>, but we can not set up the databinding... and we tried to add
CustomItems="{Binding Markers}"
CustomItemTemplate="{StaticResource CustomItemTemplate}"
but we cannot make it work.

BTW: as the code shows below, the gauge shows "CurrentFrameNumber" on the top of the gauge, and we would like the extra markers appear on the bottom of the gauge.

Could you please help?
Thanks.

<telerik:RadHorizontalLinearGauge Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="TimeGauge" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="0" OuterBackground="#00000000" OuterBorderThickness="0" Background="#00000000" BorderBrush="#00000000">
                <telerik:LinearScale x:Name="TimeScale"
                                     Min="{Binding Min}"
                                     Max="{Binding Max}"
                                     IsInteractive="True"
                                     RelativeX="0.04"
                                     RelativeWidth="0.92" RelativeY="0.6"
                                     FontSize="10"
                                     Fill="#4D0000F9"
                                     CustomItems="{Binding Markers}"
                                     CustomItemTemplate="{StaticResource CustomItemTemplate}">
                    <telerik:LinearScale.Indicators>
                        <telerik:BarIndicator x:Name="TrackBar"
                                              Value="{Binding CurrentFrameNumber, Mode=TwoWay}" IsAnimated="False" Background="#FF00C500" />
                        <telerik:Marker x:Name="CurrentFrameMarker"
                                        Value="{Binding CurrentFrameNumber, Mode=TwoWay}"
                                        telerik:ScaleObject.Offset="0.10"
                                        telerik:LinearScale.RotateForVertical="True"
                                        telerik:ScaleObject.RelativeWidth="0.04"
                                        telerik:ScaleObject.RelativeHeight="0.30"
                                        telerik:ScaleObject.Location="Outside">
                            <telerik:Marker.Template>
                                <ControlTemplate TargetType="{x:Type telerik:Marker}">
                                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                        <Polygon Points="0,0 0,0.7 0.5,1 1,0.7 1,0"
                                                 Stretch="Fill"
                                                 Fill="Yellow"
                                                 Stroke="Green"
                                                 StrokeThickness="2" />
                                    </Grid>
                                </ControlTemplate>
                            </telerik:Marker.Template>
                        </telerik:Marker>
                    </telerik:LinearScale.Indicators>
                </telerik:LinearScale>
            </telerik:RadHorizontalLinearGauge>
Andrey
Telerik team
 answered on 14 Jun 2012
1 answer
123 views
Whats up with the RadHTMLPlaceHolder Control ?

I keep finding videos that refer to it as the RadHTMLPlaceHolder Control for Silverlight and WPF but it doesnt seem to be part of WPF.
Example:
http://www.youtube.com/watch?v=2V3GBQKPQws&feature=results_main&playnext=1&list=PL26B565F9DF19A9C4

Will it be added in the future?
Using the Windows Forms HTML Webbrowser control in WPF works alright but is not designed for WPF.
Petar Mladenov
Telerik team
 answered on 14 Jun 2012
1 answer
88 views
Hi,

I would like to know if with the new release 2012.2.607.0 when we have a GridViewCheckBoxColumn in a grid, if we do some grouping, if a checkbox appear in the group header to select/unselect by a single click all the subrows of the grouped columns?

Thank's
Dimitrina
Telerik team
 answered on 13 Jun 2012
3 answers
148 views
I have these classes Task and ResourceHour
public class Task {
    public Task() {
        this.TotalHoursByResource = new List<ResourceHour>();
    }
 
    public int ID {get;set;}
    public string Name { get; set; }
    public decimal TotalHours { get; set; }
    public List<ResourceHour> TotalHoursByResource { get; set; }
}
 
public class ResourceHour {
    public string Resource { get; set; }
    public string WorkingHourType { get; set; }
    public double Hours { get; set; }
}

A list of Task objects is bound to a RadGridView and I want to create a custom aggregate on Property "TotalHoursByResource" which is a list of ResourceHour objects.

When i try to do it as below, it gives an error
No generic method '' on type '' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

public class HoursAggregate : EnumerableSelectorAggregateFunction {
    protected override string AggregateMethodName {
        get { return "GetAggregateHours"; }
    }
    protected override Type ExtensionMethodsType {
        get { return typeof(HoursAggregateType); }
    }
 
}
 
public static class HoursAggregateType {
    public static string GetAggregateHours<T>(IEnumerable<Task> source, Func<Task, List<ResourceHour>> selector) where T : Task {
        return "Some string from TotalHoursByResource";
    }
}


Any ideas if I can create a custom aggregate function to run on a property which itself is a list??
Dimitrina
Telerik team
 answered on 13 Jun 2012
4 answers
293 views
I have a couple of Masked Input controls on my form, including one date time and a couple of numeric input.  I have buttons tied to the controls through events which increase or decrease the value of the control by 1.  The values of these controls are bound to variables in my program.  Here's the Xaml:

<UserControl x:Class="CarSystem.CustomControls.TimeSpanSpinner"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:cs="clr-namespace:CarSystem.CustomControls"
             mc:Ignorable="d"
             Focusable="True"
             Loaded="UserControl_Loaded">
  
    <UserControl.Resources>
        <cs:TimeSpanToDateTimeConverter x:Key="TimeSpanConverter" />
    </UserControl.Resources>
  
    <Grid Background="{Binding Path=GridBackground, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
          Width="{Binding Path=Width, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <telerik:RadMaskedDateTimeInput BorderBrush="{Binding Path=BorderBrush, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        FlowDirection="{Binding Path=FlowDirection, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        Focusable="True"
                                        FontFamily="{Binding Path=FontFamily, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        FontSize="{Binding Path=FontSize, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        FontStretch="{Binding Path=FontStretch, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        FontStyle="{Binding Path=FontStyle, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        FontWeight="{Binding Path=FontWeight, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        GotFocus="ValueBox_GotFocus"
                                        Grid.Column="0"
                                        HorizontalAlignment="Stretch"
                                        HorizontalContentAlignment="Right"
                                        InputBehavior="Insert"
                                        IsClearButtonVisible="False"
                                        LostFocus="ValueBox_LostFocus"
                                        Margin="5"
                                        Mask="{Binding Path=Mask, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        Name="ValueBox"
                                        SelectionOnFocus="CaretToEnd"
                                        SpinMode="PositionAndValue"
                                        TabIndex="{Binding Path=TabIndex, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                        TextMode="MaskedText"
                                        UpdateValueEvent="PropertyChanged"
                                        Value="{Binding Path=Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}, Converter={StaticResource TimeSpanConverter}}"
                                        VerticalAlignment="Center" />
        <RepeatButton Background="{DynamicResource ButtonBackground}"
                      Click="IncrementButton_Click"
                      Focusable="False"
                      Foreground="{DynamicResource ButtonForeground}"
                      Grid.Column="1"
                      IsTabStop="False"
                      Name="IncrementButton">
            <Image>
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source"
                                Value="/CustomControls;component/Resources/VolumeUpDay.png" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                         Value="NightTime">
                                <Setter Property="Source"
                                        Value="/CustomControls;component/Resources/VolumeUpNight.png" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </RepeatButton>
        <RepeatButton Background="{DynamicResource ButtonBackground}"
                      Click="DecrementButton_Click"
                      Focusable="False"
                      Foreground="{DynamicResource ButtonForeground}"
                      Grid.Column="2"
                      IsTabStop="False"
                      Name="DecrementButton">
            <Image>
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source"
                                Value="/CustomControls;component/Resources/VolumeDnDay.png" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
                                         Value="NightTime">
                                <Setter Property="Source"
                                        Value="/CustomControls;component/Resources/VolumeDnNight.png" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </RepeatButton>
    </Grid>
</UserControl>

And here's the code-behind:

    public partial class TimeSpanSpinner : UserControl {
  
        public static readonly DependencyProperty FocusedBackgroundProperty =
            DependencyProperty.Register( "FocusedBackground", typeof( Brush ), typeof( TimeSpanSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty FocusedForegroundProperty =
            DependencyProperty.Register( "FocusedForeground", typeof( Brush ), typeof( TimeSpanSpinner ), new PropertyMetadata( null ) );
  
        public static DependencyProperty GridBackgroundProperty =
            DependencyProperty.Register( "GridBackground", typeof( Brush ), typeof( TimeSpanSpinner ), new PropertyMetadata( Brushes.Transparent ) );
  
        public static readonly DependencyProperty MaskProperty = 
            DependencyProperty.Register( "Mask", typeof( string ), typeof( TimeSpanSpinner ), new PropertyMetadata( "HH:mm:ss.fff" ) );
  
        public static readonly DependencyProperty TimeOfDayModeProperty =
            DependencyProperty.Register( "TimeOfDayMode", typeof( TimesOfDay ), typeof( TimeSpanSpinner ),
                                         new FrameworkPropertyMetadata( TimesOfDay.DayTime,
                                             FrameworkPropertyMetadataOptions.AffectsRender,
                                             new PropertyChangedCallback( OnTimeOfDayInvalidated ) ) );
  
        public static readonly DependencyProperty UnfocusedBackgroundProperty =
            DependencyProperty.Register( "UnfocusedBackground", typeof( Brush ), typeof( TimeSpanSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty UnfocusedForegroundProperty =
            DependencyProperty.Register( "UnfocusedForeground", typeof( Brush ), typeof( TimeSpanSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty ValueProperty = 
            DependencyProperty.Register( "Value", typeof( TimeSpan ), typeof( TimeSpanSpinner ), new PropertyMetadata( TimeSpan.Zero ) );
  
        public Brush FocusedBackground {
            get { return (Brush) GetValue( FocusedBackgroundProperty ); }
            set { SetValue( FocusedBackgroundProperty, value ); }
        }
  
        public Brush FocusedForeground {
            get { return (Brush) GetValue( FocusedForegroundProperty ); }
            set { SetValue( FocusedForegroundProperty, value ); }
        }
  
        public Brush GridBackground {
            get { return (Brush) GetValue( GridBackgroundProperty ); }
            set { SetValue( GridBackgroundProperty, value ); }
        }
  
        public string Mask {
            get { return (string) GetValue( MaskProperty ); }
            set { SetValue( MaskProperty, value ); }
        }
  
        public TimesOfDay TimeOfDayMode {
            get { return (TimesOfDay) GetValue( TimeOfDayModeProperty ); }
            set { SetValue( TimeOfDayModeProperty, value ); }
        }
  
        public Brush UnfocusedBackground {
            get { return (Brush) GetValue( UnfocusedBackgroundProperty ); }
            set { SetValue( UnfocusedBackgroundProperty, value ); }
        }
  
        public Brush UnfocusedForeground {
            get { return (Brush) GetValue( UnfocusedForegroundProperty ); }
            set { SetValue( UnfocusedForegroundProperty, value ); }
        }
  
        public TimeSpan Value {
            get { return (TimeSpan) GetValue( ValueProperty ); }
            set { SetValue( ValueProperty, value ); }
        }
  
        public TimeSpanSpinner() {
            InitializeComponent();
        }
  
        private void DecrementButton_Click( object sender, RoutedEventArgs e ) {
            // Decrement the Value in the ValueBox
            ValueBox.CallSpin( false );
        }
  
        private void IncrementButton_Click( object sender, RoutedEventArgs e ) {
            ValueBox.CallSpin( true );
        }
  
        private void OnTimeOfDayModeChanged( TimesOfDay newTimeofDayMode ) {
            if ( FocusedBackground != null && UnfocusedBackground != null ) {
                ValueBox.Background = ValueBox.IsFocused ? FocusedBackground : UnfocusedBackground;
            }
  
            if ( FocusedForeground != null && UnfocusedForeground != null ) {
                ValueBox.Foreground = ValueBox.IsFocused ? FocusedForeground : UnfocusedForeground;
            }
        }
  
        private static void OnTimeOfDayInvalidated( DependencyObject d, DependencyPropertyChangedEventArgs e ) {
            TimeSpanSpinner spinner = (TimeSpanSpinner) d;
  
            spinner.OnTimeOfDayModeChanged( (TimesOfDay) e.NewValue );
        }
  
        private void UserControl_Loaded( object sender, RoutedEventArgs e ) {
            if ( FocusedBackground == null && UnfocusedBackground == null ) {
                ValueBox.Background = Background;
            }
  
            if ( FocusedForeground == null && UnfocusedForeground == null ) {
                ValueBox.Foreground = Foreground;
            }
        }
  
        private void ValueBox_GotFocus( object sender, RoutedEventArgs e ) {
            if ( FocusedBackground != null ) {
                ValueBox.Background = FocusedBackground;
            }
  
            if ( FocusedForeground != null ) {
                ValueBox.Foreground = FocusedForeground;
            }
        }
  
        private void ValueBox_LostFocus( object sender, RoutedEventArgs e ) {
            if ( UnfocusedBackground != null ) {
                ValueBox.Background = UnfocusedBackground;
            }
  
            if ( UnfocusedForeground != null ) {
                ValueBox.Foreground = UnfocusedForeground;
            }
        }
    }
}


I want users to be able to change the value of the controls by editing them and have the value of the control change, so that if they make an edit, then hit the up or down arrow buttons, the value increments from the value they edited, not where the value was before they edited the field.

What do I need to change to make this work?

Tony
Tony
Top achievements
Rank 1
 answered on 13 Jun 2012
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?