Ambiguous match found

11 posts, 0 answers
  1. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 29 Jun 2012 Link to this post

    Hello telerik!

    After applying RadControls_for_Silverlight5_2012_2_0625_DEV_hotfix; I still get the following error when my GridView gets loaded:

    Ambiguous match found.

       at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
       at System.Type.GetProperty(String name)
       at Telerik.Windows.Controls.GridViewBoundColumnBase.GetValidationErrors(Object dataItem, String propertyName)
       at Telerik.Windows.Controls.GridView.GridViewCell.<GetDataErrors>d__7.MoveNext()
       at Telerik.Windows.Data.EnumerableExtensions.Count(IEnumerable source)
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateIsValidState()
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateValue()
       at Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement()
       at Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(GridViewCellBase cell, GridViewColumn column)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn column, Boolean createIfNull)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32 startIndex, Int32 predictedLastIndex, Func`2 calculateNextIndex)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells()
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

    Please help!
    Thanks and all the best,
    Tim.

  2. Vera
    Admin
    Vera avatar
    265 posts

    Posted 02 Jul 2012 Link to this post

    Hi Tim,

     
    This issue should be fixed. May I ask you to share more details about your exact scenario? A code-snippet or a sample project demonstrating the problem will be a plus.

    Greetings,
    Vera
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 21 Jul 2012 Link to this post

    Hello Vera, I am trying to create a sample project but it is not that easy because I am using Caliburn and some other stuff... But one question already came up: Is this also fixed for RadTreeListView? (Because that is what I am currently using, but as the RadTreeListView and the RadGridView got the same base it should be fixed here as well, right? But it is still not fixed - downloaded the latest release just a few minutes ago...)

    Thanks a lot!!!
    Tim.
  4. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 23 Jul 2012 Link to this post

    Hello!

    Unfortunately I am unable to create a sample project in reasonable time - anyway: really strange is, that it is working fine, when I replace the following line
    <telerik:GridViewDataColumn Header="Label" DataMemberBinding="{Binding SessionCount}" DataFormatString="{}{0:N0}" />

    with this line here:
    <telerik:GridViewDataColumn Header="Label" DataMemberBinding="{Binding SessionCountXXX}" DataFormatString="{}{0:N0}" />

    Of course, SessionCount and SessionCountXXX are identical beside the name. That's strange! I don't get it but it is working with any of these two lines in the old version...

    Any ideas perhaps???
    Thanks a lot,
    Tim.




  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 23 Jul 2012 Link to this post

    Hello,

     Can you post both properties implementations? 

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Jay
    Jay avatar
    6 posts
    Member since:
    Oct 2011

    Posted 24 Jul 2012 Link to this post

    I'm also seeing this error with version 2012.2.607.1050.

    In my case, I've extended the RadGridView control so that I can pass in a configuration object parameter and have it build columns with specific datatypes so that sorting and filtering will work properly.

    public class FeatureResultGrid : RadGridView
        {
            private List<string> _blackListedColumns = new List<string>()
            {
                "OBJECTID", "SHAPE", "GEOG"
            };
     
            private RelayCommand _copyToClipboardCommand;
            public RelayCommand CopyToClipboardCommand
            {
                get
                {
                    return _copyToClipboardCommand = new RelayCommand(
                        () =>
                        {
                            StringBuilder clipboard = new StringBuilder();
     
                            if (this.Items.Count > 0)
                            {
                                clipboard.AppendLine("<TABLE>");
     
                                clipboard.AppendLine("<TR>");
                                foreach (var col in GridConfig.ColumnDefinitions)
                                {
                                    clipboard.AppendFormat("<TH>{0}</TH>", col.DisplayName);
                                }
                                clipboard.AppendLine("</TR>");
     
                                foreach (Graphic graphic in this.Items)
                                {
                                    clipboard.AppendLine("<TR>");
                                    foreach (var col in GridConfig.ColumnDefinitions)
                                    {
                                        clipboard.AppendFormat("<TD>{0}</TD>", graphic.Attributes[col.DisplayName].ToString());
                                    }
                                    clipboard.AppendLine("</TR>");
                                }
                                clipboard.AppendLine("</TABLE>");
                            }
                            System.Windows.Clipboard.SetText(clipboard.ToString());
                        }
                    );
                }
            }
     
     
            public FeatureResultGrid()
            {
                AutoGenerateColumns = false;
     
                SelectionMode = System.Windows.Controls.SelectionMode.Multiple;
                SelectionChanged += (s, e) =>
                {
                    if (GridConfig != null && GridConfig.SelectedItems != null)
                    {
                        if (e.AddedItems != null)
                        {
                            foreach (var item in e.AddedItems)
                            {
                                GridConfig.SelectedItems.Add((Graphic)item);
                            }
                        }
                        if (e.RemovedItems != null)
                        {
                            foreach (var item in e.RemovedItems)
                            {
                                GridConfig.SelectedItems.Remove((Graphic)item);
                            }
                        }
                    }
                };
            }
     
     
     
            #region -------------------- FeatureGridConfiguration --------------------
            /// <summary>
            /// The <see cref="GridConfig" /> dependency property's name.
            /// </summary>
            public const string GridConfigPropertyName = "GridConfig";
     
            /// <summary>
            /// Gets or sets the value of the <see cref="GridConfig" />
            /// property. This is a dependency property.
            /// </summary>
            public FeatureGridParameter GridConfig
            {
                get
                {
                    return (FeatureGridParameter)GetValue(GridConfigProperty);
                }
                set
                {
                    SetValue(GridConfigProperty, value);
                }
            }
     
            /// <summary>
            /// Identifies the <see cref="GridConfig" /> dependency property.
            /// </summary>
            public static readonly DependencyProperty GridConfigProperty = DependencyProperty.Register(
                GridConfigPropertyName,
                typeof(FeatureGridParameter),
                typeof(FeatureResultGrid),
                new PropertyMetadata(null,
                    (d, e) =>
                    {
                        ((FeatureResultGrid)d).BuildColumns(((FeatureGridParameter)e.NewValue).ColumnDefinitions);
                    }
                    )
                );
     
            #endregion -------------------- FeatureGridConfiguration --------------------
     
            private void BuildColumns(IList<ColumnDefinition> columns)
            {
                foreach (var columnDef in columns)
                {
                    if (!_blackListedColumns.Contains(columnDef.DisplayName.ToUpper()))
                    {
                        GridViewDataColumn col = new GridViewDataColumn();
                        col.DataMemberBinding = new Binding(columnDef.BindingString);
                        col.MaxWidth = 300;
                        col.TextWrapping = TextWrapping.Wrap;
                        col.Header = columnDef.DisplayName;
                        col.DataType = columnDef.DataType;
                        col.UniqueName = columnDef.DisplayName;
     
                        col.DataFormatString = columnDef.GetFormat();
                        col.ShowDistinctFilters = false;
                        col.IsSortable = true;
     
                        Columns.Add(col);
     
     
                        if (columnDef.IsInitialSortColumn)
                        {
                            this.SortDescriptors.Add(new ColumnSortDescriptor()
                            {
                                Column = col,
                                SortDirection = System.ComponentModel.ListSortDirection.Descending
                            }
                            );
                        }
                    }
                }
            }
     
        }

    This is the parameters class:
    /// <summary>
    /// Class encapsulates all of the parameter information for a feature grid. 
    /// Using this method solves the problem where we need to take action only
    /// when all parameters have been passed in to the control.
    /// </summary>
    public class FeatureGridParameter :INotifyPropertyChanged
    {
        private string _uniqueIdColumnName;
        private IList<ColumnDefinition> _columnDefinitions;
     
        /// <summary>
        /// The name of the column that holds the unique values.  For ArcGis
        /// Server feature services, this is usually OBJECTID.
        /// </summary>
        public string UniqueIdColumn
        {
            get
            {
                return _uniqueIdColumnName;
            }
            set
            {
                if (value != _uniqueIdColumnName)
                {
                    _uniqueIdColumnName = value;
                    RaisePropertyChanged("UniqueIdColumn");
                }
            }
        }
     
        /// <summary>
        /// List of all available columns
        /// </summary>
        public IList<ColumnDefinition> ColumnDefinitions
        {
            get
            {
                return _columnDefinitions;
            }
            set
            {
                if (value != _columnDefinitions)
                {
                    _columnDefinitions = value;
                    RaisePropertyChanged("ColumnDefinitions");
                }
            }
        }
     
     
        public ObservableCollection<Graphic> SelectedItems { get; set; }
     
        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
     
    }

    This is how I implemented it in xaml:
    <foc:FeatureResultGrid
        GridConfig="{Binding Path=GridConfiguration}"
        ItemsSource="{Binding }"                      
        CanUserSelect="False"
        ShowGroupPanel="False" IsReadOnly="True" IsFilteringAllowed="False"
        CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" 
        >
        <toolkit:ContextMenuService.ContextMenu>
            <toolkit:ContextMenu>
                <toolkit:MenuItem Header="Copy" IsEnabled="True" >
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <mvvm:EventToCommand Command="{Binding Path=CopyToClipboardCommand}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </toolkit:MenuItem>
            </toolkit:ContextMenu>
        </toolkit:ContextMenuService.ContextMenu>
        <foc:FeatureResultGrid.Columns>
            <telerik:GridViewColumn >
                <telerik:GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <telerik:RadButton
                            BorderThickness="0" Padding="0"
                            Height="17" Width="17"
                            ToolTipService.ToolTip="Center map on point." >
                            <telerik:RadButton.Content>
                                <Path Fill="Transparent" Stroke="Black" StrokeThickness=".75">
                                    <Path.Data>
                                        <GeometryGroup>
                                            <EllipseGeometry RadiusX="4" RadiusY="4" Center="6,6"/>
                                            <LineGeometry StartPoint="0,6" EndPoint="11,6"></LineGeometry>
                                            <LineGeometry StartPoint="6,0" EndPoint="6,11"></LineGeometry>
                                        </GeometryGroup>
                                    </Path.Data>
                                </Path>
                            </telerik:RadButton.Content>
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <mvvm:EventToCommand
                                        Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.FlashFeatureCommand}"
                                        CommandParameter="{Binding}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </telerik:RadButton>
                    </DataTemplate>
                </telerik:GridViewColumn.CellTemplate>
            </telerik:GridViewColumn>
        </foc:FeatureResultGrid.Columns>
    </foc:FeatureResultGrid>

    Ambiguous match found.
    Stack Trace:
       at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
       at System.Type.GetProperty(String name)
       at Telerik.Windows.Controls.GridViewBoundColumnBase.GetValidationErrors(Object dataItem, String propertyName)
       at Telerik.Windows.Controls.GridView.GridViewCell.<GetDataErrors>d__7.MoveNext()
       at Telerik.Windows.Data.EnumerableExtensions.Count(IEnumerable source)
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateIsValidState()
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateValue()
       at Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement()
       at Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(GridViewCellBase cell, GridViewColumn column)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn column, Boolean createIfNull)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32 startIndex, Int32 predictedLastIndex, Func`2 calculateNextIndex)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells()
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)


    Let me know if you'd like me to create a sample project.

    Thanks!
    Jay
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 24 Jul 2012 Link to this post

    Hi Jay,

     Please open support ticket and send us small project demonstrating the error. 

    Regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Jay
    Jay avatar
    6 posts
    Member since:
    Oct 2011

    Posted 25 Jul 2012 Link to this post

    I'm having trouble replicating the issue in a sample project.  In the project where I'm seeing the issue, I've narrowed the problem down to setting the DataMemberBinding property of a GridViewDataColumn to a binding that uses a dictionary path.  

    I've reverted to using version 2012.1.326.1050 where the problem does not exist.

    Jay
  9. Vera
    Admin
    Vera avatar
    265 posts

    Posted 25 Jul 2012 Link to this post

    Hello Jay,

     
    Thank you for the project sent. I tested it with our Latest Internal Build and I did not get the exception. May I ask you to download it and to give it a try? 

    Kind regards,
    Vera
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. Andrea
    Andrea avatar
    1 posts
    Member since:
    Aug 2010

    Posted 24 Sep 2012 Link to this post

    Hi Vera,

    I have this problem when binding to strongly typed datasets by using the square braket notation in the Binding like the example below.

      <telerik:GridViewDataColumn IsReadOnly="True" Header="Nr" DataMemberBinding="{Binding Path=[CU_NumeroPratica]}">
                        </telerik:GridViewDataColumn>

    Thank you,

    Giulio
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 Sep 2012 Link to this post

    Hello,

     Can you post more info about your grid version? Are you using our latest official Q2 2012 SP2?

    Regards,
    Vlad
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top