My Requirement is I want add Image for RadComboBoxItem from static folder. The following was my code.
<telerik:RadComboBox Name="Salutaion" Grid.Column="4" Width="75" Grid.Row="0" HorizontalAlignment="Left"
IsEditable="True" IsReadOnly="True" telerik:StyleManager.Theme="Office_Blue"
ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear">
<telerik:RadComboBoxItem Content="Male"/>
<telerik:RadComboBoxItem Content="Female"/>
</telerik:RadComboBox> Thanks and Regards Naresh Mesineni
Hy,
When moving our application window or resizing it then we get an ArgumentNullException in the DataItemAutomationPeer class.
We are currently on the binaries RadControls for WPF Q1 2011.
I looked at the currently available source code "01348RadControls_for_WPF_40_2011_1_0613_DEV_hotfix".
Callstack on Exception:
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.DataItemAutomationPeer.DataItemAutomationPeer(object dataItem, Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer dataControlAutomationPeer) Line 78 C#
> Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataItemAutomationPeer.GridViewDataItemAutomationPeer(object dataItem, Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer dataControlAutomationPeer) Line 25 C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.RadGridViewAutomationPeer.CreateDataItemAutomationPeer(object dataItem) Line 97 + 0x2f bytes C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer.GeneratePeersForDataItems(System.Collections.Generic.List<System.Windows.Automation.Peers.AutomationPeer> newPeerList, Telerik.Windows.Controls.GridView.Automation.AutomationPeerStorage<object,Telerik.Windows.Controls.GridView.Automation.DataItemAutomationPeer> oldCachedPeers) Line 111 + 0x1c bytes C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer.GetItemPeers() Line 101 C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewVirtualizingPanelAutomationPeer.GetChildrenCore() Line 79 + 0x21 bytes C#
What I saw in the source is:
In class GridViewDataControlAutomationPeer a check is done for (dataitem == null), see below:
private void GeneratePeersForDataItems(List<AutomationPeer> newPeerList, AutomationPeerStorage<object, DataItemAutomationPeer> oldCachedPeers)
{
foreach (object dataItem in this.Items)
{
DataItemAutomationPeer dataItemPeer = oldCachedPeers.FindPeer(dataItem);
if (dataItemPeer == null)
dataItemPeer = this.CreateDataItemAutomationPeer(dataItem);
SetUpOwnerRowEventsSource(dataItemPeer);
this.cachedPeers[dataItem] = dataItemPeer;
newPeerList.Add(dataItemPeer);
}
}
Then later in the ctor of DataItemAutomationPeer I saw the following code:
protected DataItemAutomationPeer(object dataItem, GridViewDataControlAutomationPeer dataControlAutomationPeer)
: base(dataControlAutomationPeer.OwnerGridViewDataControl)
{
if (dataItem == null)
throw new ArgumentNullException("dataItem");
if (dataControlAutomationPeer == null)
throw new ArgumentNullException("dataControlAutomationPeer");
this.dataItem = dataItem;
this.dataControlAutomationPeer = dataControlAutomationPeer;
}
In my case I get the exception from this check in the ctor.
Kind regards,
Yvonne