Telerik Forums
UI for WPF Forum
3 answers
229 views

Dear Friends,

I have a windows forms application. I hosted the the "RadTreeView" inside a windows form using an "ElementHost" control. if I click on the treeview item I got an "NullReferenceException" in the "RadTreeView_GotFocus" method. By checking the source code of the method we found the problem. 

The "Application.Current" is always null for a WinForms Applicaiton. So an exception throws on the first line of the code. Since It is unhandled It crashed the application.

Is there any workaround or solution to the above problem? I have attched the exception call stack too.

RadTreeView_GotFocus Method Source
-----
private void RadTreeView_GotFocus(object sender, RoutedEventArgs e)
{
    if (Application.Current.MainWindow != null)
    {
        Application.Current.MainWindow.MouseWheel += new MouseWheelEventHandler(this.OnRootVisualMouseWheel);
    }
    if (e.OriginalSource == this)
    {
        if (this.SelectedContainer != null)
        {
            this.SelectedContainer.Focus();
        }
        else
        {
            RadTreeViewItem item = base.ItemContainerGenerator.ContainerFromIndex(0) as RadTreeViewItem;
            if (item != null)
            {
                item.Focus();
            }
        }
    }
    this.IsSelectionActive = true;
}

Steps To reproduce 

1. Create a WinForms Application (Target Framework to .NET 3.5)
1a. Add a reference to these dlls (Telerik.Windows.Controls & Telerik.Windows.Controls.Navigation)
2. Add a WPF UserControl to the project. And add the following XAML.
       <telerik:RadTreeView >
            <telerik:RadTreeViewItem Header="Sony"  >
                <telerik:RadTreeViewItem Header="Vaio"  />
                <telerik:RadTreeViewItem Header="Bravia"  />
            </telerik:RadTreeViewItem>
        </telerik:RadTreeView>
3. Add a "ElementHost" control to the exisiting "Form1 (Windows Form)". 
4. Build the project
5. Set the child property of the ElementHost to an instance of the WPF UserControl we created.
6. Build and Run the application.
7. Click over a treeviewitem. 
8. The application will crash.

Runtime Details
Windows Vista 32 bit Business Edition
VS.NET 2008 Professional With SP1
.NET Framework 3.5 SP1
Telereik Version : 2009.1.424.35 (both Telerik.Windows.Controls & Telerik.Windows.Controls.Navigation)

The exception call stack.
 Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeView.RadTreeView_GotFocus(object sender = {Telerik.Windows.Controls.RadTreeView Items.Count:1}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) + 0x2a bytes 
  PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x78 bytes 
  PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {Sony}, System.Windows.RoutedEventArgs args = {System.Windows.RoutedEventArgs}, bool reRaised = false) + 0x1bf bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {Sony}, System.Windows.RoutedEventArgs args = {System.Windows.RoutedEventArgs}) + 0x79 bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs e) + 0x17 bytes 
  PresentationCore.dll!System.Windows.UIElement.OnGotFocus(System.Windows.RoutedEventArgs e) + 0x5 bytes 
  PresentationFramework.dll!System.Windows.FrameworkElement.OnGotFocus(System.Windows.RoutedEventArgs e) + 0x4c bytes 
  PresentationCore.dll!System.Windows.UIElement.IsFocused_Changed(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) + 0xa2 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes 
  PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x50 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x2c bytes 
  WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {IsFocused}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes 
  WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey key, object value) + 0x39 bytes 
  PresentationCore.dll!System.Windows.Input.FocusManager.OnFocusedElementChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) + 0xf0 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes 
  PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x50 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x2c bytes 
  WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {FocusedElement}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes 
  WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes 
  WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x2e bytes 
  PresentationCore.dll!System.Windows.Input.FocusManager.SetFocusedElement(System.Windows.DependencyObject element, System.Windows.IInputElement value) + 0x2f bytes 
  PresentationFramework.dll!System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(System.Windows.DependencyObject focusTarget = {Sony}) + 0x32 bytes 
  PresentationFramework.dll!System.Windows.FrameworkElement.OnGotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e = {System.Windows.Input.KeyboardFocusChangedEventArgs}) + 0x47 bytes 
  PresentationCore.dll!System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x34 bytes 
  PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes 
  PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes 
  PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {Sony}, System.Windows.RoutedEventArgs args = {System.Windows.Input.KeyboardFocusChangedEventArgs}, bool reRaised = false) + 0x1bf bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {Sony}, System.Windows.RoutedEventArgs args = {System.Windows.Input.KeyboardFocusChangedEventArgs}) + 0x79 bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args = {System.Windows.Input.KeyboardFocusChangedEventArgs}, bool trusted) + 0x35 bytes 
  PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x311 bytes 
  PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x42 bytes 
  PresentationCore.dll!System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject focus, int timestamp) + 0x63e bytes 
  PresentationCore.dll!System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject newFocus, System.Windows.Input.IKeyboardInputProvider keyboardInputProvider, bool askOld, bool askNew, bool forceToNullIfFailed) + 0x12b bytes 
  PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject focus, bool askOld, bool askNew) + 0xc2 bytes 
  PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement element) + 0x1a bytes 
  PresentationCore.dll!System.Windows.UIElement.Focus() + 0x1a bytes 
  Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeViewItem.OnHeaderMouseLeftButtonDown(object sender = {System.Windows.Controls.Grid}, System.Windows.Input.MouseButtonEventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0x7f bytes 
  PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes 
  PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes 
  PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes 
  PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {System.Windows.Controls.Grid}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = true) + 0x1bf bytes 
  PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender = {System.Windows.Controls.Grid}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, System.Windows.RoutedEvent newEvent) + 0x10a bytes 
  PresentationCore.dll!System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(System.Windows.DependencyObject sender, System.Windows.Input.MouseButtonEventArgs e) + 0x2e bytes 
  PresentationCore.dll!System.Windows.UIElement.OnMouseDownThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) + 0xde bytes 
  PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes 
  PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes 
  PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes 
  PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {System.Windows.Controls.TextBlock}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = false) + 0x1bf bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {System.Windows.Controls.TextBlock}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}) + 0x79 bytes 
  PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool trusted) + 0x35 bytes 
  PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x311 bytes 
  PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x42 bytes 
  PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes 
  PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x2e2 bytes 
  PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd = 591552, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 589869, ref bool handled = false) + 0x4e1 bytes 
  PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd = 591552, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 589869, ref bool handled = false) + 0x75 bytes 
  WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 591552, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 589869, ref bool handled = false) + 0xbe bytes 
  WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7a bytes 
  WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = {System.Object DispatcherCallbackOperation(System.Object)}}, object args = {MS.Win32.HwndSubclass.DispatcherOperationCallbackParameter}, bool isSingleParameter = true) + 0x8a bytes 
  WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x4a bytes 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x91 bytes 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x40 bytes 
  WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 591552, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 589869) + 0xdc bytes 
  [Native to Managed Transition] 
  [Managed to Native Transition] 
> System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) Line 2106 + 0x8 bytes C#
  System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) Line 3377 + 0x1b bytes C#
  System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) Line 3261 + 0xa bytes C#
  System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) Line 1466 C#
  WinAppCS.exe!WinAppCS.Program.Main() Line 18 + 0x1d bytes C#
  [Native to Managed Transition] 
  [Managed to Native Transition] 
  mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) Line 931 + 0x1f bytes C#
  Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes 
  mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) Line 61 + 0xffffffe3 bytes C#
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 355 + 0xd bytes C#
  mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Line 88 + 0xffffffe4 bytes C#

prakash
Top achievements
Rank 1
 answered on 19 Jun 2009
3 answers
287 views
Hi
 I want to bind values to my 

GridViewComboBoxColumn

from a DataTable
and I "fly"

this is my code
<telerik:RadGridView.Columns> 
                <telerik:GridViewComboBoxColumn     
                                    DataMemberBinding="{Binding Path=UnitName}"      
                                    DisplayMemberPath="Name"     
                                    SelectedValueMemberPath="ID"     
                                    HeaderText="שם היחידה"     
                                    UniqueName="UnitName" Width="120" /> 
                  
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 

DataTable dt = new DataTable();  
dt.Columns.Add("UnitName",typeof(int));  
dt.Rows.Add(1);  
dt.Rows.Add(2);  
((GridViewComboBoxColumn)this.gvLoadingCustomers.Columns["UnitName"]).ItemsSource = GetUnits();                  
gvLoadingCustomers.ItemsSource = dt.DefaultView;  
            

private DataView GetUnits()  
        {  
            DataTable dt = new DataTable();  
            dt.Columns.Add("Id", typeof(int));  
            dt.Columns.Add("Name", typeof(string));  
            dt.Rows.Add(1,"חטיבה בנקאית");  
            dt.Rows.Add(2,"חטיבה מסחרית");  
            dt.Rows.Add(3,"חטיבה עסקית");  
            dt.Rows.Add(4,"GPB");  
            dt.Rows.Add(5,"מת''מ");  
            return dt.DefaultView;  
        }  
 

when I bind the data to the Combo from a 

System.Collections.

IEnumerable

 

it works, but when I use a dataTable it fail...

Thanks
Rossen Hristov
Telerik team
 answered on 19 Jun 2009
1 answer
144 views

Dear Friends,

We are using the RadTreeView in one of our outlook addin application. The Radtreeview works fine in a WPF application. But in the addin it crashes the outlook when a treeview item is clicked.

If I debug I got the follwing error in VS.NET 2008 Debugger.

"An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module."

The call stack is,

kernel32.dll!_RaiseException@16()  + 0x58 bytes 
  mscorwks.dll!RaiseTheExceptionInternalOnly()  + 0x159 bytes 
  mscorwks.dll!RaiseTheException()  + 0x4e bytes 
  mscorwks.dll!RaiseTheException()  + 0xc0 bytes 
  mscorwks.dll!RealCOMPlusThrow()  + 0x30 bytes 
  mscorwks.dll!RealCOMPlusThrow()  + 0xd bytes 
  mscorwks.dll!Thread::RaiseCrossContextException()  + 0x1ff bytes 
  mscorwks.dll!Thread::DoADCallBack()  + 0x13095b bytes 
  mscorwks.dll!_UM2MDoADCallBack@16()  + 0x7c bytes 
  0a25847a() 
  user32.dll!_InternalCallWinProc@20()  + 0x23 bytes 
  user32.dll!_UserCallWinProcCheckWow@32()  + 0xb3 bytes 
  user32.dll!_DispatchMessageWorker@8()  + 0xe6 bytes 
  user32.dll!_DispatchMessageW@4()  + 0xf bytes 
  MSO.DLL!30d11bbe()  
  [Frames below may be incorrect and/or missing, no symbols loaded for MSO.DLL] 
  OUTLLIB.DLL!30053fb2()  
  OUTLOOK.EXE!300012d5()  
  kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes 
  ntdll.dll!__RtlUserThreadStart@8()  + 0x27 bytes 

There is no managed stack here.
 
Is there anyway to solve the problem?

The sample project contain source code and a setup project. Just install the setup project. The addin comes in the bottom of the left naviagtion pane. Click any one of the trreview item. You can see the outlook crashed.

I have uploaded a sample project that reproduce the erorr in the following location.
http://www.4shared.com/file/112645778/c879187b/XInlook.html

 

Thanks & Regards
Prakash

prakash
Top achievements
Rank 1
 answered on 19 Jun 2009
4 answers
324 views
Dear Sir,
I have an application which  loading UserControl Dynamically with code, inside the UserControl I have a RadGrdivView which contains a Checkbox Column, theis is the code i have:
Window:
-----

<Window x:Class="Window2"

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

Title="Window2" Height="300" Width="300" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

 

 

 

<Grid>

 

 

 

<telerik:RadTabControl Name="RadTabControl1">

 

 

 

<telerik:RadTabItem Header="Tab1" Name="tb1">

 

 

 

 

</telerik:RadTabItem>

 

 

 

<telerik:RadTabItem Header="Tab2" Name="tb2">

 

 

 

</telerik:RadTabItem>

 

 

 

</telerik:RadTabControl>

 

 

 

</Grid>

 

</

 

Window>




 

Partial Public Class Window2

 

 

Private Sub Window2_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded

 

 

Dim db As New TeachersDataContext

 

 

Dim Te = (From t In db.Teachers Select t).ToList

 

 

 

For Each itm As Telerik.Windows.Controls.RadTabItem In RadTabControl1.Items

 

 

Dim uc As New UserControl1

 

uc.ds = Te

uc.SetDG()

itm.Content = uc

 

Next

 

 

 

 

 

End Sub

 

End

 

Class



UserControl:
----

<

 

UserControl x:Class="UserControl1"

 

 

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>

 

 

 

 

<telerik:RadGridView Name="gvTeachers" telerik:StyleManager.Theme="Summer" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" IsReadOnly="True" ShowGroupPanel="False">

 

 

 

<telerik:RadGridView.Columns>

 

 

 

<telerik:GridViewDataColumn Width="Auto">

 

 

 

<telerik:GridViewColumn.CellTemplate>

 

 

 

<DataTemplate>

 

 

 

<CheckBox Name="chkIs_Selected" Margin="3" IsChecked="True" ></CheckBox>

 

 

 

</DataTemplate>

 

 

 

</telerik:GridViewColumn.CellTemplate>

 

 

 

</telerik:GridViewDataColumn>

 

 

 

<telerik:GridViewDataColumn HeaderText="Teacher Name" HeaderTextAlignment="Center" Width="*">

 

 

 

<telerik:GridViewColumn.CellTemplate>

 

 

 

<DataTemplate>

 

 

 

<TextBlock Text="{Binding Teacher_Full_Name}"></TextBlock>

 

 

 

</DataTemplate>

 

 

 

</telerik:GridViewColumn.CellTemplate>

 

 

 

</telerik:GridViewDataColumn>

 

 

 

</telerik:RadGridView.Columns>

 

 

 

</telerik:RadGridView>

 

 

 

 

</Grid>

 

</

 

UserControl>

 



Partial

 

Public Class UserControl1

 

 

Private _ds As List(Of Teacher)

 

 

Public Property ds() As List(Of Teacher)

 

 

Get

 

 

Return _ds

 

 

End Get

 

 

Set(ByVal value As List(Of Teacher))

 

_ds = value

 

End Set

 

 

End Property

 

 

Public Sub SetDG()

 

gvTeachers.ItemsSource = _ds

 

End Sub

 

End

 

Class

 



The problem i have is:
when i run the application all the checkboxes is checked (which is the default state) but when i uncheck some of them and then swich to another tab all the checkboxes is returning to its original state (Checked).
I tried to simulate this issue without loading the UserControls at runtime (I put two RadGridVIews in the TabControl) and everyting is running OK,
Why this happing and if there is any way to solve this please tell me.

Thank you





 

 


 

 

 



UserControl
--------------

 

Sameh
Top achievements
Rank 1
 answered on 18 Jun 2009
3 answers
251 views

Hello, following the post:
http://www.telerik.com/community/forums/wpf/gridview/multi-line-header.aspx

I have a much more simple solution using escape chars, however

,as you can see by running the below example, when I add the
telerik:StyleManager.Theme="Simple"
the last text line of the header (ccc) is not displayed.

Is there a way to overcome it ?

Thanks,

Erez


<Window x:Class="ChangeTelerikGridHeaderSize.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="333" Width="582" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <StackPanel Orientation="Horizontal">
        <telerik:RadGridView Name="radGridView1"
                             ShowGroupPanel="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn UniqueName="ABC" HeaderText="aaa&#13;bbb&#13;ccc" Width="Auto"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

        <telerik:RadGridView Name="radGridView2"
                             telerik:StyleManager.Theme="Simple"
                             ShowGroupPanel="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn UniqueName="ABC" HeaderText="aaa&#13;bbb&#13;ccc" Width="Auto"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </StackPanel>
</Window>

Kalin Milanov
Telerik team
 answered on 18 Jun 2009
1 answer
106 views
Hi,

In my application,I have a combobox in a window, in which some numeric values are there to set zoom for the application.
when I Click on the combo box and than click on the restore button of the window, I get a window that ask for RadTreeViewItem.Events.cs file.

It gives follwing code at disassambly.

c:\Builds\WPF_Scrum\WPF_Team\Sources\Development\Silverlight\Telerik.Windows.Controls.Navigation\TreeView\RadTreeViewItem.Events.cs
00000000  push        ebp 
00000001  mov         ebp,esp
00000003  sub         esp,8
00000006  mov         dword ptr [ebp-8],ecx
00000009  mov         dword ptr [ebp-4],edx
0000000c  cmp         dword ptr ds:[075A0B60h],0
00000013  je          0000001A
00000015  call        6D42ADF1
0000001a  mov         ecx,dword ptr [ebp-8]
0000001d  xor         edx,edx
0000001f  call        005A8148
00000024  mov         ecx,dword ptr [ebp-8]
00000027  call        005A78F0
0000002c  nop             
0000002d  mov         esp,ebp
0000002f  pop         ebp 
00000030  ret         4 

after this my application get crash.Can anybody help me out to find the reason behind this.

***Application works well if Combo's IsEditable= False,but if it is True application gets crash.

Thanks,
Anshul
Miroslav Nedyalkov
Telerik team
 answered on 18 Jun 2009
3 answers
182 views
Hi
I have an async data source in my ViewModel class.
I want to force the grid to show it's animation.
I set that DataLoadMode property to Asynchronous but it's not working (the grid don't know that there is background operation)
How can I make it work?
(In silverlight it was IsBusy state but here it's readonly )
Thanks
Adiel
Adiel
Top achievements
Rank 2
 answered on 18 Jun 2009
5 answers
292 views
Hi

Is there any documentation on using this feature (I'm assuming this will allow us to show some animation whilst the grid is loading data)?
Milan
Telerik team
 answered on 18 Jun 2009
1 answer
537 views
                    <telerik:GridViewDataColumn Width="25">  
                        <telerik:GridViewDataColumn.CellStyle> 
                            <Style TargetType="telerik:GridViewCell">  
                                <Setter Property="Template">  
                                    <Setter.Value> 
                                        <ControlTemplate TargetType="telerik:GridViewCell">  
                                            <Button   
                                            Command="{Binding IngredientDeleteCommand}" 
                                            HorizontalAlignment="Center"   
                                            VerticalAlignment="Center">  
                                                <Image Height="20" Width="20" Source="/CakeBoss.WPF;component/Images/delete.png" /> 
                                            </Button> 
                                        </ControlTemplate> 
                                    </Setter.Value> 
                                </Setter> 
                            </Style> 
                        </telerik:GridViewDataColumn.CellStyle> 
                    </telerik:GridViewDataColumn> 

I've got a column that is for deleting a row, and I'm using MVVM so i'm binding to a command instead of using the click event on the button.  The command does not fire from inside the grid, but the Click event does.   If I copy the button outside the grid the button works just great.  Any clues?
Jon
Top achievements
Rank 1
 answered on 18 Jun 2009
3 answers
246 views
I am populating a treeview control from a database. I want to allow the user to drag and drop nodes to arrange the nodes in a sort order. I was trying to use the DragEnded event to get the new position in the tree and update the new position in the database. I thought I could use the IndexOf to get the new position in the tree the node is located. If I drag a root node the Items.IndexOf for the dragged node returns the correct position, lower level nodes return -1. The code I am using is as follows:

    Private Sub RadTreeView1_DragEnded(ByVal sender As ObjectByVal e As Telerik.Windows.Controls.RadTreeViewDragEndedEventArgs) Handles RadTreeView1.DragEnded  
 
        Dim newSortOrder As Integer 
        Dim parentId As Integer 
 
        Dim draggedItem As RadTreeViewItem = e.DraggedItems(0)  
        Dim eStore As eStoreDataDataContext = New eStoreDataDataContext  
 
        If IsNothing(draggedItem.ParentItem) Then 
            ' no parent then item is root node  
            parentId = 0  
        Else 
            parentId = draggedItem.ParentItem.Tag.ToString  
        End If 
 
        newSortOrder = RadTreeView1.Items.IndexOf(draggedItem)  
 
        MsgBox("parentId = " & parentId.ToString)  
        MsgBox("newSortOrder = " & newSortOrder.ToString)  
 
    End Sub 
 


 I am using the tag property to identify the parentId value in my database table. Does anyone know why the Items.IndexOf returns a number corresponding to the order the item is displayed in the tree for root node items and -1 for all other nodes?

Thanks.
Kiril Stanoev
Telerik team
 answered on 17 Jun 2009
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?