Telerik Forums
UI for WPF Forum
1 answer
206 views
Dear team,

I have a problem when setting the IsDropDownOpenProperty on a RadComboBox, Yes, I know there's a similar post (that I've read) but that did not help me to solve my problem. ;)
I have a RadGridView, where the CellEditTemplate of a given column must change at runtime, depending on the type of row that is currently being edited.
So I have an event handler at the RadGridView SelectionChanged event, that determines the type of row (meaning the type of data we have inside it), and then dinamically builds a DataTemplate that is assigned to the grid column.
In one particular case, this template is a RadComboBox with a set of available values, and the core instructions that build this template are the followings:

FrameworkElementFactory radComboFactory = new FrameworkElementFactory ( typeof ( RadComboBox ), "RadComboFactory" ); 
radComboFactory.SetValue ( RadComboBox.ItemsSourceProperty, property.AvailableValues ); 
radComboFactory.SetValue ( RadComboBox.SelectedValuePathProperty, "Key" ); 
radComboFactory.SetValue ( RadComboBox.SelectedValueProperty, currentValue ); 
radComboFactory.SetValue ( RadComboBox.IsDropDownOpenProperty, true ); 
radComboFactory.SetValue ( CSRadComboSelectionChanged.CommandProperty, CellEditTemplateComboSelectionChange ); 
propertyDataTemplate.VisualTree = radComboFactory; 
propertyDataTemplate.Seal ( ); 

Everything worked fine, until I introduced the 4th dependecy property, which is RadComboBox.IsDropDownOpenProperty because I clearly wanted the combo box to be displayed already opened.
The template is built correctly, but this gives me an error when it is going to be instantiated into my RadGridView's column.
The exception details are:
System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Telerik.Windows.Controls.Input"
  StackTrace:
   at Telerik.Windows.Controls.RadComboBox.OnIsDropDownOpenChanged(Boolean oldValue, Boolean newValue) 
   at Telerik.Windows.Controls.RadComboBox.OnIsDropDownOpenChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) 
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) 
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal) 
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) 
   at System.Windows.FrameworkTemplate.SetTemplateParentValues(String name, Object element, FrameworkTemplate frameworkTemplate, ProvideValueServiceProvider& provideValueServiceProvider) 
   at System.Windows.FrameworkElementFactory.InstantiateUnoptimizedTree() 
   at System.Windows.FrameworkTemplate.LoadContent() 
   at Telerik.Windows.Controls.GridViewColumn.CreateCellEditElement(GridViewCell cell, Object dataItem) 
   at Telerik.Windows.Controls.GridView.GridViewCell.SetEditorContent(Object content) 
   at Telerik.Windows.Controls.GridView.GridViewCell.ShowEditor() 
   at Telerik.Windows.Controls.GridView.GridViewCell.<ToggleEditor>b__0() 
   at Telerik.Windows.Controls.GridView.GridViewCell.ModifyCellTemplate(Action executeAction) 
   at Telerik.Windows.Controls.GridView.GridViewCell.ToggleEditor() 
   at Telerik.Windows.Controls.GridView.EditContext.OnCellEditModeChanged(GridViewCell cell, Boolean newIsInEditMode) 
   at Telerik.Windows.Controls.GridView.GridViewCell.IsInEditModeChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) 
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) 
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) 
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal) 
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) 
   at Telerik.Windows.Controls.GridView.GridViewCell.set_IsInEditMode(Boolean value) 
   at Telerik.Windows.Controls.GridView.EditContext.SwitchCellToEditMode(GridViewCell cell) 
   at Telerik.Windows.Controls.GridView.EditContext.BeginEdit(GridViewCell gridViewCell) 
   at Telerik.Windows.Controls.GridView.EditContext.OnCellMouseUp(GridViewCell cell) 
   at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonUp(MouseButtonEventArgs e) 
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) 
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) 
   at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e) 
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) 
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) 
   at System.Windows.Input.InputManager.ProcessStagingArea() 
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) 
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) 
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) 
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
   at System.Windows.Interop.HwndSource.InputFilterMessage(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, Boolean isSingleParameter) 
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) 
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
   at System.Windows.Threading.Dispatcher.Run() 
   at System.Windows.Application.RunDispatcher(Object ignore) 
   at System.Windows.Application.RunInternal(Window window) 
   at System.Windows.Application.Run(Window window) 
   at System.Windows.Application.Run() 
   at ***********.Shell.App.Main() in *****************************************************************\obj\Debug\App.g.cs:line 0 
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Threading.ThreadHelper.ThreadStart() 

 (a bit long, sorry ... )

If I comment out the faulty line, the DataTemplate is instantiated correctly, and I can see my combo box in the RadGridView, but it is obviously closed, which is not fine for my case.
I also tried a similar, parallel case, where I replaced the RadComboBox with standard Windows WPF ComboBox, and I was surprised that I can use the ComboBox.IsDropDownOpenProperty without any problem, and the ComboBox that is built, is shown already opened just like I wanted it to be.

I would be happy to use a workaround also, to fix this.

Thanks a lot for your effort and do not hesitate to ask me any further information that may help you.

Kind Regards.

Max.
Valeri Hristov
Telerik team
 answered on 21 Oct 2009
2 answers
125 views
In thefollowing grid, it seems that the HeaderText attribute is ignored. Why is that?

Sorry to ask, but the documentation is thin or I am missing something.

        <telerik:RadGridView Grid.Row="1" Name="pagesGridView" telerik:StyleManager.Theme="Vista" DataLoadMode="Synchronous" AutoGenerateColumns="False" CanUserInsertRows="False" CanUserFreezeColumns="False" UseAlternateRowStyle="True" ColumnsWidthMode="Auto" ShowGroupPanel="False">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn  x:Name="IdColumn" HeaderText="Id"  Width="75" DataMemberPath="Id" IsReadOnly="True"  /> 
                <telerik:GridViewDataColumn  x:Name="StatusColumn" HeaderText="Link"  Width="200" DataMemberPath="LinkUrl" /> 
                <telerik:GridViewDataColumn  x:Name="Title" HeaderText="Name"  Width="*" DataMemberPath="Title" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
Kenneth Jamieson
Top achievements
Rank 1
 answered on 21 Oct 2009
4 answers
64 views
When I put line in my xaml file:

<telerik:RadGridView Name="dataGrid" ColumnsWidthMode="Fill" IsReadOnly="True"  AutoGenerateColumns="False" DataLoadMode="Asynchronous"
                             RowIndicatorVisibility="Collapsed" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />

 after removing  ColumnsWidthMode="Fill" works ok





I get:


   w System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
   w System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   w System.Windows.Controls.Primitives.ScrollBar.set_ViewportSize(Double value)
   w Telerik.Windows.Controls.GridView.ScrollBarStateController.UpdateScrollBar(ScrollBar scrollBar, ScrollBarProperties properties) w c:\Builds\WPF_Scrum\GridView_WPF_2009_Q2_SP1\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\ScrollBarStateController.cs:wiersz 60
   w Telerik.Windows.Controls.GridView.ScrollBarStateController.UpdateVerticalScrollBarsProperties(ScrollBarProperties properties) w c:\Builds\WPF_Scrum\GridView_WPF_2009_Q2_SP1\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\ScrollBarStateController.cs:wiersz 49
   w Telerik.Windows.Controls.GridView.GridViewScrollViewer.UpdateScrollBars() w c:\Builds\WPF_Scrum\GridView_WPF_2009_Q2_SP1\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewScrollViewer.cs:wiersz 503
   w Telerik.Windows.Controls.GridView.GridViewScrollViewer.GridViewScrollViewer_LayoutUpdated(Object sender, EventArgs e) w c:\Builds\WPF_Scrum\GridView_WPF_2009_Q2_SP1\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewScrollViewer.cs:wiersz 534
   w System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
   w System.Windows.ContextLayoutManager.UpdateLayout()
   w System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   w System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   w System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   w System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   w System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   w System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
L uke
Top achievements
Rank 1
 answered on 21 Oct 2009
3 answers
130 views
Hello,

I have a grid.

I click on a cell and and a MouseUp event occurs.

I do what I do and then I want to cancel the focus of the cell without transferring the focus to a different cell.

Is that possible ?

Thanks,

Erez

Rossen Hristov
Telerik team
 answered on 21 Oct 2009
2 answers
152 views

Hey all,

I have a RadGrid on a Wpf page, it is goign to be loading data from a Astoria service. Right away, we need to bind it programatically - the declarative syntax won't work since I need to do some set up.

Ideally, I would grab a data subset and do the binding directly, but there is at least one problem... Astoria (int he release bits) doesn't support Count() so I cannot bind the grid directly. In other words, I cannot...

 

var corePages = contextCore.CmsPageSet.OrderBy(p => p.Title);  
pageListGridView.ItemsSource = corePages;  

Instead I have to...

 

var corePages = contextCore.CmsPageSet.OrderBy(p => p.Title);  
pageListGridView.ItemsSource = corePages.ToList(); 

Which is seriously suboptimal because it means grabbing all the records over the wire to project them into the list so that the grid is happy with them. Ugly, ugly, ugly.

It gets even worse because since this is not the astoria CTP2, I can't do projections on the server, either which means I pull down all the columns for each record, even though I only need three for the grid. I need Id, Title and Sortweight. Of those, I need Id to be hidden, so that I can access it as a key when a user clicks on a row (I need to pull up a window for the edit) but the user is not bothered with it in the grid proper.

So here are my questions....

  1. Has anyone managed a direct bind between a RadGridView and an astoria data service - am I barking up the wrong tree?
  2. How do you give the RadGridView a list of columns to use from a programtically bound data source? I knwo how to declare the columns, but I am unsure how to tie them to the (future) properties of the anonymous type I will be binding after the projection. UniqueName didn't seem to be enough. The documentation is very weak in this reguard.
  3. By any chance, does someone know the proper syntax for a lambda style .Select LINQ statement to pull multiple columns out?

Thanks!

Kenneth Jamieson
Top achievements
Rank 1
 answered on 21 Oct 2009
1 answer
83 views
We just downloaded the latest version of Telerik controls and we have noticed that the RadDataGrid for WPF has a misterious dot on the middle right hand side of the screen. (see atttached)

Any ideas where the dot / circle may be comming from?
Vlad
Telerik team
 answered on 21 Oct 2009
6 answers
180 views
If I attempt to open Example.xaml from the Docking project in the Examples_WPF.CS project installed by the Q3 beta the VS designer  errors on loading the xaml and I get the following error:

Error    28    Invalid XmlnsDeclaration occurs in assembly 'Telerik.Windows.Controls.Docking, Version=2009.3.916.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'. XmlnsDeclaration references a namespace 'Telerik.Windows.Controls.GridView' that is not in the assembly.    C:\Program Files\Telerik\RadControls for WPF Q3 2009\Demos\Docking\FirstLook\Example.xaml    1    1    Examples_WPF.CS

Otherwise the project seems to build and run just fine.
Nikolay
Telerik team
 answered on 20 Oct 2009
1 answer
123 views
Hi,

In "RadControls_for_WPF_2009_3_1016_TRIAL",
on the GridView->CustomFilterRow sample, when you choose to filter the Date column,
And selected date from the date picker the date is not shown in the text filter row.

Thanks
Vlad
Telerik team
 answered on 20 Oct 2009
1 answer
198 views
Hello,

I'm attempting to add and remove items to the RadTileView. I'm having trouble removing the item from the collection. I'm sure I'm missing something obvious.

public partial class Window1 : Window  
    {  
        RadTileViewItem item0 = new RadTileViewItem() { Header = "1" };  
        RadTileViewItem item1 = new RadTileViewItem() { Header = "2" };  
        RadTileViewItem item2 = new RadTileViewItem() { Header = "3" };  
 
        public Window1()  
        {  
            InitializeComponent();  
 
              
            tileview.Items.Add(item0);  
            tileview.Items.Add(item1);  
            tileview.Items.Add(item2);  
 
        }  
 
        void btn_Click(object sender, RoutedEventArgs e)  
        {  
                tileview.Items.Remove(item1);  
        }  
    } 
<Window x:Class="addDeleteTileViewItem.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">  
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="30" /> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <Button Click="btn_Click" /> 
        <telerik:RadTileView Name="tileview" Grid.Row="1" /> 
    </Grid> 
</Window> 

When I click the button i get a KeyNotFoundException.
Any help would be appreciated.

Thanks again,
Boots
Tihomir Petkov
Telerik team
 answered on 20 Oct 2009
1 answer
157 views
Hi,

I have following questions:

1. Can we have a RadGridView grouping similar to MS Outlook, where we have items grouped like "Today", "Yesterday" etc.
In the online samples, grouping works similar to that but it shows it as tree kind of and a vertical band line. Can we remove that (vertical band line on left side) and show the child items in simple row?

2. How we can add image to the Row selector (not as a column) and also how to add image to a column using code?
3. How we can hide (remove) RadGridView Header and Grouping title bar area?

Thanks,
Sanjeev
Stefan Dobrev
Telerik team
 answered on 20 Oct 2009
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
DataPager
PersistenceFramework
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?