Telerik Forums
UI for WPF Forum
8 answers
552 views
TypeA & TypeB both implement the same base type.  We are binding the RadGridView's ItemSource to an IList<BaseType> baseList

When we have the grid view filtering out TypeA and re-generate our baseList object, the on property changed throws the following:

As a note, we are using a custom hierarchy (as found in the examples: Telerik\RadControls for WPF Q1 2011 SP1\Demos\Examples\GridView\Hierarchy\CustomHierarchy)
-Type B has a list of TypeA,
-only TypeB is expandable (to show list of TypeA).

System.InvalidCastException: Unable to cast object of type 'TypeA' to type 'TypeB'.
   at System.Linq.Enumerable.<CastIterator>d__aa`1.MoveNext()
   at Telerik.Windows.Data.QueryableCollectionView.PopulateInternalList(IQueryable view)
   at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
   at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
   at Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency()
   at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
   at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh()
   at Telerik.Windows.Data.QueryableCollectionView.OnFilterDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
   at Telerik.Windows.Data.RadObservableCollection`1.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at Telerik.Windows.Data.CollectionExtensions.RemoveItems[T](ICollection`1 collection, IEnumerable`1 items)
   at Telerik.Windows.Data.DataItemCollection.RemoveDescriptorsFromCollectionView()
   at Telerik.Windows.Data.DataItemCollection.set_CollectionView(QueryableCollectionView value)
   at Telerik.Windows.Data.DataItemCollection.CreateCollectionView(IEnumerable source)
   at Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass18.<Bind>b__17()
   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(Object oldValue, Object newValue)
   at Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(DependencyObject origin, DependencyPropertyChangedEventArgs args)
   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, OperationType operationType)
   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
   at System.Windows.Data.BindingExpression.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 System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at OurCode.NotifyPropertyChanged[T](Expression`1 propertySelector) in [Our stack trace here...]
Yavor Georgiev
Telerik team
 answered on 15 Jun 2011
1 answer
122 views
Hi,

I tried to add combox to one of the column header in my TreeListView as below, but it doesn't work.

 

<telerik:GridViewDataColumn  DataMemberBinding="{Binding UnweightedCount, Mode=OneWay}">
    <telerik:GridViewColumn.Header>
        <DataTemplate>
            <ComboBox >
                <ComboBoxItem  Name="cbi1">Item1</ComboBoxItem>
                <ComboBoxItem  Name="cbi2">Item2</ComboBoxItem>
                <ComboBoxItem  Name="cbi3">Item3</ComboBoxItem>
            </ComboBox>
        </DataTemplate>
    </telerik:GridViewColumn.Header>
</telerik:GridViewDataColumn>
 

By the way, I was going to attach some pictures, I couldn't find attach button when I edit this thread.

Regarding,

Fendy
Vlad
Telerik team
 answered on 15 Jun 2011
1 answer
117 views
I am trying to use a CellEditTemplate to define a RadDatePicker on a GridView cell. Reason for this is that I want to control the Selectable Dates, so the user cannot select a date after today. It is partially working.

I've defined a TextBlock as the CellTemplate and the RadDatePicker as the CellEditTemplate. But when I select a date and move to the next cell, it's not updating the value in the view mode for that cell.

I'm sure I'm missing something to make this work. How do I define a RadDatePicker as teh CellEditTemplate on a GridViewDataColumn bound to a property on my VM?
Rayne
Top achievements
Rank 1
 answered on 14 Jun 2011
0 answers
188 views
I'm setting my textbox to pick up the application theme and for a few of my controls, I need to remove the right rounded corners.

I'm basically trying to make a DropDownButton look sort of like an editable comboBox. I've got it working with the exception of the corner radius of the styled textbox. If I give the right side a border thickness of 1 so that it divides the text area from teh dropdown button, then the corners on that side show up.

How do I remove the corner radius from the right side just for these specific textboxes?
Rayne
Top achievements
Rank 1
 asked on 14 Jun 2011
3 answers
951 views
I'm using a drop down button to display a context menu of options. But I'd like the content of the button to appear as a TextBox (like an editable combobox, but read-only). Is this possible?

If not, can I at least left align the text that gets displayed? I'm using a ContentTemplate and setting HorizontalAlignment and TextAlignment to Left on the TextBlock, but it still is aligning to the center of the control.

Essentially I want it to look like an editable combobox (with a textbox and dropdown button to the side; textbox can look disabled/read-only).
Rayne
Top achievements
Rank 1
 answered on 14 Jun 2011
1 answer
355 views
Telerik support,

I have a RadTreeView that is populated with DataBinding to an XML data file.  I use a Hierarchical DataTemplate in the XAML code to populate the Tree.  I would like to use the following in the C# code-behind to delete elements with the delete key.  This works fine for all of the first-level nodes in the Tree.  I would like to be able to select child items also and delete them in the same way.  The child items are created with DragAndDrop.

Here is the code to delete the parent items:

void MyView_KeyDown(object sender, KeyEventArgs e)
        {          
            if (e.Key.Equals(Key.Delete))
            {
                IList source = this.MyView.ItemsSource as IList;
                source.Remove(MyView.SelectedItem);                               
            }
        }

How can I change this to delete the child items also?  I have looked at some of the examples in the forum, and I found

foreach

 

 

(MyItem item in MyView.ItemsSource)

 

 

    {

 

 

 

    foreach (MyItem child in item.Children)

 

 

        {

 

            source.Remove(MyView.SelectedItem);

 

        }

 

    }


but I don't know what to use for item.Children in the 2nd foreach statement if this is the best way to find all child nodes.

Thanks,
Scott
Scott
Top achievements
Rank 1
 answered on 14 Jun 2011
1 answer
129 views
Hello telerik-Team,

Starting-Situation:
Adding more as you can see(in the ScrollViewer) to the TabControl.
http://theupload.co.de/images/1_bitab.JPG

Problem:
If you add an item, the ScrollViewer don't scroll to the last item you have just added.
You have to scroll manual with the scroll arrow to the last item.
http://theupload.co.de/images/2_bitab.JPG
I hope you understand my problem.

Question:
How could i solve this problem.
Petar Mladenov
Telerik team
 answered on 14 Jun 2011
2 answers
149 views
I have some data with many columns, which usually displays with a horizontal scroll bar.  But when the user edits a row, I would like all of the columns to be on the screen at once for that row.   

Is there a way to fold a row with many columns so that it continues on one or more lines?   If so, could the continuation line(s) have column headings?
Troy Goddu
Top achievements
Rank 1
 answered on 14 Jun 2011
4 answers
269 views
Hi,
I use event 'Filtered' to capture a user column filtering.

I want send this filter over the wire (WCF) to a server and call a query there.

the problem is to serialize DistinctValuesFilterDescriptor ...

Do you provide any solution how to use DistinctValuesFilterDescriptor and send it over the WCF ...

thanks in advance

Robert



Robert
Top achievements
Rank 1
 answered on 14 Jun 2011
2 answers
428 views
I have a RadDateTimePicker control in a view that is bound to a datetime property in the associated viewmodel using the SelectedValue of the RadDateTimePicker. When the user selects a date and / or time, the datetime property in the viewmodel is set accordingly. However, if the user subsequently clears the input and the default 'Enter date' text is displayed in the control, the datetime property in the viewmodel is not set to null / mindatetime.

How can I implement the RadDateTimePicker so that if a user clears the datetime from the control the SelectedValue becomes null or mindatetime?
Yana
Telerik team
 answered on 14 Jun 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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?