Telerik Forums
UI for WPF Forum
2 answers
250 views
Hi all,

I am using a RadGridView to display a list of DataRowBase objects which implements the ICustomTypeDescriptor. When the grid starts to populate its rows I observed some "first chance" ArgumentExceptions printed out in the output window of the IDE. ("An exception (first chance) of the type "System.ArgumentException" occurred in System.ComponentModel.DataAnnotations.dll" - translated from German).
As the grid showed all my data correctly, I could probably ignore the messages - but it was very slow in doing so. So I used a hard-coded class with the same data and the same grid and this was significantly faster (and didn't throw any exceptions). (I need to use a generic approach as the application allows the user to display data of csv files and I want to utilize all features of the grid view, like filtering, sorting, grouping etc.)

I took my while to find out how to track this exception message down to its root:
The original exception message is: "The type "DataRowBase" does not contain a public property "RefDate"." (translated from German, may not be accurate)
And it seems to be thrown by some code in "GridViewVirtualizingPanel.cs".

I can't see whether this exception is thrown by the above class or somewhere deeper in the .net framework (as the message in the output window suggests, see above). But it is interesting to see that the exception is thrown only once per row, not per row and column (as all my columns are generic).

This leads to the assumption that the interface ICustomTypeDescriptor is not used properly. I found a very helpful article on how this interface is used by System.ComponentModel.TypeDescriptor in an older issue of the MSDN Magazine: MSDN Magazine: ICustomTypeDescriptor, Part 1: "... Before going straight to the metadata to get property information, TypeDescriptor first checks to see if the type being examined implements the System.ComponentModel.ICustomTypeDescriptor interface. If it does, (...), rather than using the metadata to get property information, TypeDescriptor will simply ask the object (through its ICustomTypeDescriptor.GetProperties method) which properties it supports."

I added some Debug.WriteLine's to my ICustomTypeDescriptor.GetProperties() implementation and this revealed that
a) the above exception is thrown after a first call to GetProperties() of each(!) DataRowBase instance in my list, and
b) GetProperties() is called for every displayed column of the same instance (w/o exception) [why that? An initial call should be sufficient]

My question is here: Is this a problem of the RadGridView? Or does the problem lie deeper within the framework?

Any help/suggestion is highly appreciated!

Thanks,
Thorsten

PS
I am using RadControls for WPF, Q2 2013 and WPF 4.5
Thorsten
Top achievements
Rank 1
 answered on 09 Aug 2013
1 answer
79 views
Hi,

I wants t create the functionality like Region available in Visual Studio which allow to expand and collapse the code or text.

How to imlement ?

Please help or suggest.



Thanks & Regards

Sopan Vaidya
Iva Toteva
Telerik team
 answered on 09 Aug 2013
1 answer
664 views
Hi I am having problem with template binding to visualstate. I need to change background color on action MouseOver (specifically Foreground color on Text) is there any way how to do it?
here is my xaml template:
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                    xmlns:local="clr-namespace:CustomControl">
 
 
    <Style TargetType="{x:Type local:RadCustomBtn}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="#FF848484"/>
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="#408AD2"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:RadCustomBtn}">
                    <Grid SnapsToDevicePixels="True">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#679ED2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="White"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper"/>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#679ED2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="disabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="BackgroundVisibility">
                                <VisualState x:Name="BackgroundHidden">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterBorder"/>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="disabledBorder"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="BackgroundVisible"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStatesGroup">
                                <VisualState x:Name="Unfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.15">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
                            <Border x:Name="InnerBorder" BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding InnerCornerRadius}"/>
                        </Border>
                        <Border x:Name="disabledBorder" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFE0E0E0" CornerRadius="{TemplateBinding CornerRadius}" Visibility="Collapsed"/>
 
 
 
                      
                        <!--<ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Style="{DynamicResource radButton_style_label}"/>-->
                        <StackPanel Orientation="{TemplateBinding Orientation}" HorizontalAlignment="Center"
                            <Viewbox>
                                <StackPanel Width="{TemplateBinding IconWidth}" Height="{TemplateBinding IconHeight}" Visibility="{TemplateBinding IconVisibility}">
                                    <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Icon}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Style="{DynamicResource radButton_style_label}"/>
                                </StackPanel>
                            </Viewbox>
                            <StackPanel Width="auto" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
                                <TextBlock Text="{TemplateBinding Text}" Foreground="{TemplateBinding Foreground}" FontSize="40"></TextBlock>
                            </StackPanel>
                        </StackPanel>
                         
                        <Border x:Name="CommonStatesWrapper">
                            <Border x:Name="FocusVisual" BorderBrush="#FFFFFF" BorderThickness="1" Background="Transparent" CornerRadius="{TemplateBinding CornerRadius}" Opacity="0" Visibility="Collapsed">
                                <Border x:Name="FocusInnerVisual" BorderBrush="Transparent" BorderThickness="1" CornerRadius="{TemplateBinding InnerCornerRadius}"/>
                            </Border>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
</ResourceDictionary>

Kiril Vandov
Telerik team
 answered on 09 Aug 2013
1 answer
210 views
I am having a color rendering problem using RadPdfViewer.  Colors are shifted when displayed through the viewer.
See below for the RGB values of the original compared to the RGB values of the Telerik display.  I cannot attach the files as they contain sensitive data.  I don't see any settings that facilitate having any influence over the color profiles. 

I'd be interested to know who else has seen similar issues as well as whether or not Telerik says this is a known issue or plans to do anything about it.

acro reader (original)

purple
RGB: 74-24-107

gray in background of center top graphic
RGB: 189-186-189

telerik

purple rendered as blue
RGB: 0-0-181

gray in background of center top graphic
RGB: 181-178-181
Kammen
Telerik team
 answered on 09 Aug 2013
3 answers
144 views
Hi,
I have used RadCartesianChart.Behaviors
<telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior PanMode="Both" ZoomMode="Both" />
</telerik:RadCartesianChart.Behaviors>

in my application. After complete zooming when the zoom and pan bars are brought down slowly the labels of y-axis overlap with the vertical axis.
Please let me know the solution for this problem as soon as possible. How far i can make out is it the bug in the tool?
Ves
Telerik team
 answered on 09 Aug 2013
1 answer
119 views
Hi,

I want to change appointment day by day (with the cursor) in timeline (not minute by minute).

This is my xaml code :

<telerik:RadScheduleView  Grid.Row="1"
                                 AppointmentsSource="{Binding LstAppointments}"
                                 ResourceTypesSource="{Binding LstSchedulerHeaderOperations}"
                                 CategoriesSource="{Binding Categories}"
                                 CurrentDate="{Binding CurrentDate}"
                                 SelectedSlot="{Binding SelectedSlot, Mode=TwoWay}" Margin="10,20,10,10">
                <telerik:RadScheduleView.ViewDefinitions>
                    <telerik:TimelineViewDefinition VisibleDays="65"  MajorTickLength="1day" MinorTickLength="1day"
                        TimerulerMajorTickStringFormat="{}{0:dd}">
                        <telerik:TimelineViewDefinition.GroupTickLength>
                            <local:MonthlyTickProvider />
                        </telerik:TimelineViewDefinition.GroupTickLength>
                    </telerik:TimelineViewDefinition>
                </telerik:RadScheduleView.ViewDefinitions>
                <scheduleView:RadScheduleView.GroupDescriptionsSource>
                    <scheduleView:GroupDescriptionCollection>
                        <scheduleView:ResourceGroupDescription ResourceType="OP" />
                        <telerik:ResourceGroupDescription ResourceType="DETAIL" />
                    </scheduleView:GroupDescriptionCollection>
                </scheduleView:RadScheduleView.GroupDescriptionsSource>
            </telerik:RadScheduleView>


My MonthlyTickProvider class :

public class WeeklyTickProvider : DependencyObject, ITickProvider
    {
        public static readonly DependencyProperty CurrentDateProperty =
            DependencyProperty.Register(
            "CurrentDate", typeof(DateTime),
            typeof(WeeklyTickProvider), null
            );
 
        public DateTime CurrentDate
        {
            get { return (DateTime)GetValue(CurrentDateProperty); }
            set { SetValue(CurrentDateProperty, value); }
        }
 
        public static readonly DependencyProperty VisibleDaysProperty =
            DependencyProperty.Register(
            "VisibleDays", typeof(int),
            typeof(WeeklyTickProvider), null
            );
 
        public int VisibleDays
        {
            get { return (int)GetValue(VisibleDaysProperty); }
            set { SetValue(VisibleDaysProperty, value); }
        }
 
 
        public string GetFormatString(IFormatProvider formatInfo, string formatString, DateTime currentStart)
        {
            var start = currentStart.Date;
            var end = this.GetNextStart(TimeSpan.Zero /*not used, see below*/, currentStart).AddSeconds(-1);
 
            if (this.CurrentDate > start && this.CurrentDate < end)
                start = this.CurrentDate;
 
            //var viewEnd = this.CurrentDate.AddDays(this.VisibleDays).AddSeconds(-1);
 
            //if (viewEnd < end)
            //    end = viewEnd;
 
            return string.Format(formatInfo, "{0:dd/MMMM/yyyy} - {1:dd/MMMM/yyyy}", start, end);
        }
 
        public DateTime GetNextStart(TimeSpan pixelLength, DateTime currentStart)
        {
            var currentDate = currentStart.Date;
 
            var weekStart = CalendarHelper.GetFirstDayOfWeek(currentStart, DayOfWeek.Tuesday);
            if (weekStart == currentDate)
            {
                return weekStart.AddDays(7);
            }
            return weekStart;
        }
    }
 
    public class MonthlyTickProvider : ITickProvider
    {
        public string GetFormatString(IFormatProvider formatInfo, string formatString, DateTime currentStart)
        {
            return string.Format(formatInfo, "{0:MMMM - yyyy}", currentStart);
        }
 
        public DateTime GetNextStart(TimeSpan pixelLength, DateTime currentStart)
        {
            var currentDate = currentStart.Date;
 
            var monthStart = CalendarHelper.GetStartOfMonth(currentStart.Year, currentStart.Month);
            if (monthStart == currentDate)
            {
                return monthStart.AddMonths(1);
            }
            return monthStart;
        }
    }



NICOLAS
Top achievements
Rank 1
 answered on 09 Aug 2013
4 answers
366 views
I'm working with the getting started article to demonstrate a basic implementation of the DragDropManager by dragging between two ListBoxes - http://www.telerik.com/help/wpf/dragdropmanager-getting-started.html ;

The following code produces an ArgumentException error - The value "System.Windows.DataObject" is not of type "ManageDragDrop.ApplicationInfo" and cannot be used in this generic collection.

private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            ((IList)(sender as ListBox).ItemsSource).Add(args.Data);
        }


Nick
Telerik team
 answered on 09 Aug 2013
4 answers
212 views
Our project uses Prism with great success. One of our Prism regions is a RadTabControl and we programmatically add and remove tabs via Prism. Each of our tabs needs to have a close button so we've defined a ClosableTabItemHeader that looks like this:

<UserControl x:Class="Infrastructure.Controls.ClosableTabItemHeader"
             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"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Screen.DisplayName}"
                   FontWeight="DemiBold" />
        <telerik:RadButton Width="14"
                           Height="14"
                           Margin="5,0,0,0"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           Command="{Binding Screen.CloseCommand}"
                           Padding="0">
            <Image Source="pack://application:,,,/Resources;component/Glyphs/24/cross.png"
                   Height="10"
                   Width="10" />
        </telerik:RadButton>
    </StackPanel>
</UserControl>

Our RadTabItems use our ClosableTabItemHeader as such...

<telerik:RadTabItem.Header>
    <Controls:ClosableTabItemHeader DataContext="{Binding}" />
</telerik:RadTabItem.Header>

For months this worked without any problems at all. Lately, however, we're noticing that we sometimes have to click the close button two or more times for the command to execute. We've gone over our code with a fine tooth comb and from what we can tell the bound command simply isn't being called. We're out of ideas so we're hoping that Telerik might have one or two.

Greg
Pavel R. Pavlov
Telerik team
 answered on 08 Aug 2013
3 answers
612 views
Hello,

I am using a radGridView in a WPF Application I'm building. I want that if My user will hover his mouse over the radGridView, if it is full with information, it will give me the row index in a messagebox (or something like that). For that, I'm trying to use the

MouseOver MouseMove event. The Problem is, it doesn't fire, no matter what I do. Is it a known bug or am I doing any thing wrong?


Thanks in advance,

Yonatan
Dimitrina
Telerik team
 answered on 08 Aug 2013
2 answers
110 views
Hi, I'm try to test the RadPane using GUI ATPS and I use UISPY to find parts of the RadPane but, with the RadPane area hidden, leaving just the AutoHide area/button on display, when I hover the mouse over this area it does not show up in UISPY.
Dimitar
Telerik team
 answered on 08 Aug 2013
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
Book
FileDialogs
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
Rating
SplashScreen
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?