<telerik:RadComboBox ItemsSource="{Binding MinorTickProviders}" SelectedItem="{Binding SchedulerViewSettings.MinorTickLength,Mode=TwoWay}"> <telerik:RadComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding ., Converter={StaticResource TickConverter}}" /> </DataTemplate> </telerik:RadComboBox.ItemTemplate> </telerik:RadComboBox>private List<ITickProvider> minorTickProviders;public List<ITickProvider> MinorTickProviders { get { return this.minorTickProviders; }}this.minorTickProviders = new List<ITickProvider>();this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(2, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(5, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(10, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(15, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(20, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(30, 0, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(0, 1, 0, 0, 0)));this.minorTickProviders.Add(new FixedTickProvider(new DateTimeInterval(0, 2, 0, 0, 0)));this.minorTickProviders.Add(AutomaticTickLengthProvider.MinorProvider);public class TickConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { FixedTickProvider provider = value as FixedTickProvider; if (provider != null) { string interval = string.Format("{0:d2}:{1:d2}:00", provider.Interval.Hours, provider.Interval.Minutes); if (provider.Interval.Hours == 0 && provider.Interval.Minutes == 0) { if (provider.Interval.Days == 1) { interval = "1 day"; } else { interval = string.Format("{0} days", provider.Interval.Days); } } return interval; } return "Automatic conversion"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }private ITickProvider mMinorTickLenght; public ITickProvider MinorTickLength { get { return mMinorTickLenght; } set { mMinorTickLenght = value; } }MinorTickLength = new FixedTickProvider(new DateTimeInterval(20, 0, 0, 0, 0));Properties are not displayed in the propertygrid if the class implements ICustomTypeDescriptor. Why?
--
/// <summary> /// Interaction logic for Myobjects.xaml /// </summary> public partial class Myobjects : Page { public Myobjects() { InitializeComponent(); radPropertyGrid1.AutoGeneratingPropertyDefinition += new EventHandler<Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs>(radPropertyGrid1_AutoGeneratingPropertyDefinition); radPropertyGrid1.Item = new Variable(); } void radPropertyGrid1_AutoGeneratingPropertyDefinition(object sender, Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs e) { AttributeCollection attributes = TypeDescriptor.GetProperties(typeof(Variable))[e.PropertyDefinition.DisplayName].Attributes; BrowsableAttribute browsable = attributes[typeof(BrowsableAttribute)] as BrowsableAttribute; if (browsable != null) { e.Cancel = !browsable.Browsable; } //CategoryAttribute category = attributes[typeof(CategoryAttribute)] as CategoryAttribute; //if (category.Category == "Common") //{ // e.Cancel = false; //} } } public class Variable : ICustomTypeDescriptor, INotifyPropertyChanged { [Browsable(false)] [Category("Common")] public int Id { get; set; } [Category("Common")] public string Name { get; set; } [XmlAttribute("mandatoryCondition")] [Category("Required Field")] public string MandatoryCondition { get; set; } [XmlAttribute("mandatoryConditionMessage")] [Category("Required Field")] public string MandatoryConditionMessage { get; set; } /// <summary> /// Datatype of the Variable /// </summary> private DataType dataType = DataType.String; [XmlAttribute("dataType")] [Category("Common")] public DataType DataType { get { return this.dataType; } set { this.dataType = value; NotifyPropertyChanged("DataType"); } } #region ICustomTypeDescriptor Members public AttributeCollection GetAttributes() { return TypeDescriptor.GetAttributes(this, true); } public string GetClassName() { return TypeDescriptor.GetClassName(this, true); } public string GetComponentName() { return null; } public TypeConverter GetConverter() { return TypeDescriptor.GetConverter(this, true); } public EventDescriptor GetDefaultEvent() { return TypeDescriptor.GetDefaultEvent(this, true); } public PropertyDescriptor GetDefaultProperty() { return TypeDescriptor.GetDefaultProperty(this, true); } public object GetEditor(Type editorBaseType) { return null; } public EventDescriptorCollection GetEvents(Attribute[] attributes) { return TypeDescriptor.GetEvents(this, attributes, true); } public EventDescriptorCollection GetEvents() { return TypeDescriptor.GetEvents(this, true); } public object GetPropertyOwner(PropertyDescriptor pd) { return this; } public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { return this.GetProperties(); } // Method implemented to expose mandatory field properties conditionally, depending on DataType property public PropertyDescriptorCollection GetProperties() { var props = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(this, true)) { if (prop.Category == "Common" && this.DataType != DataType.String) continue; if (prop.Category == "Range" && (this.DataType != DataType.Integer && this.DataType != DataType.Float)) continue; if (prop.Category == "Required Field") continue; props.Add(prop); } return props; } #endregion #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String info) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(info)); } } #endregion } public enum DataType { String, Integer, Float, Boolean, Date }
<telerik:RadWindow x:Class="WPF.TestForm1" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Height="300" Width="300" Header="Hello"> <Grid> </Grid></telerik:RadWindow>Ã MS.Internal.VSUtilities.GetBuildAction(IVsHierarchy hierarchy, UInt32 itemid) Ã Microsoft.VisualStudio.ExpressionHost.HostServices.HostSourceItem.<>c__DisplayClass9.<Microsoft.Expression.DesignHost.IHostSourceItem.get_BuildItemType>b__7() Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker() Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall) Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.InvokeCall(Call call) Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.DirectInvoke(Action action, Int32 sourceApartmentId, Int32 targetApartmentId, Int32 originId, WaitHandle aborted) Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.DirectInvokeInbound(Action action, Int32 targetApartmentId) Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId) Ã Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action) Ã Microsoft.VisualStudio.ExpressionHost.HostServices.HostSourceItem.Microsoft.Expression.DesignHost.IHostSourceItem.get_BuildItemType() Ã Microsoft.Expression.DesignHost.HostSourceItemData..ctor(IHostSourceItem item) Ã Microsoft.VisualStudio.ExpressionHost.HostServices.HostProject.<Microsoft.Expression.DesignHost.IHostProject.get_InitializationData>d__7e.MoveNext() Ã Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteEnumerable`2.RemoteEnumerationThunk.<>c__DisplayClass8.<NextChunk>b__7() Ã Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15() Ã Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()<telerik:SumFunction ResultFormatString="{}{0:C}"/>
</telerik:GridViewDataColumn.AggregateFunctions>
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at Telerik.Windows.Controls.GridView.AggregatesToGroupFooterAggregatesConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewFooterCellBase.cs:line 169
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.OnDataContextChanged(DependencyObject contextElement)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
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.TreeWalkHelper.OnInheritablePropertyChanged(DependencyObject d, InheritablePropertyChangeInfo info)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
at System.Windows.DependencyObject.ClearValue(DependencyProperty dp)
at Telerik.Windows.Controls.GridView.DataCellsPresenter.AggregateResultCollection_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 113
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 149
at Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 265
at Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3436
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3638
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 656
at Telerik.Windows.Data.DataItemCollection.RaiseChangeEvents() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 912
at Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source, Type itemType) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 773
at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass14.<Bind>b__13() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3575
at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\CursorManager.cs:line 16
at Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3544
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(Object oldValue, Object newValue) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3199
at Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(DependencyObject origin, DependencyPropertyChangedEventArgs args) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\DataControl.cs:line 143
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.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 OpenSolutions.Sys.Client.Windows.Common.BaseViewModel.OnPropertyChanged(String property) in D:\OSI\Core\DEV\Extensions\RPDashboard\Src\OSI.Core.RPDashboard.Client.Windows\OpenSolutions.Sys.Client.Windows\Common\BaseViewModel.cs:line 30
at OSI.Core.RPDashboard.Client.Windows.ViewModels.RelationshipSummaryFeeIncomeViewModel.set_FeeIncome(ObservableCollection`1 value) in D:\OSI\Core\DEV\Extensions\RPDashboard\Src\OSI.Core.RPDashboard.Client.Windows\ViewModels\RelationshipSummaryFeeIncomeViewModel.cs:line 90
at OSI.Core.RPDashboard.Client.Windows.ViewModels.RelationshipSummaryFeeIncomeViewModel.RefreshView() in D:\OSI\Core\DEV\Extensions\RPDashboard\Src\OSI.Core.RPDashboard.Client.Windows\ViewModels\RelationshipSummaryFeeIncomeViewModel.cs:line 131
at OSI.Core.RPDashboard.Client.Windows.ViewModels.RelationshipSummaryFeeIncomeViewModel.<RefreshData>b__3() in D:\OSI\Core\DEV\Extensions\RPDashboard\Src\OSI.Core.RPDashboard.Client.Windows\ViewModels\RelationshipSummaryFeeIncomeViewModel.cs:line 109
at OpenSolutions.Sys.Client.Windows.WpfDispatcher.TryExecuteAction(Action action)