WPF and bindingnavigator

6 posts, 1 answers
  1. Kwabena
    Kwabena avatar
    9 posts
    Member since:
    Jan 2009

    Posted 26 Jul 2010 Link to this post

    I downloaded a project from Telerik named WPFBindingNavigator to get bindingnavigator into my WPF project.  The downloaded project works when run, but the designer throws an "object reference not set to an instance of the object" error.  I am trying to replicate the functionality within my WPF application but cannot seem to get past this error during design time.

    Following is a snippet of the error in the "Presentation" project (which references the WPFBindingNavigator, which is a class library):
     
    xmlns:bn="clr-namespace:BindingNavigator;assembly=BindingNavigator"
    The next code block raises the error mentioned above:
    <bn:BindingNavigator Grid.Row="0" Margin="2" 
    Background="Wheat"
    x:Name="navigator"
    ItemsSource="{Binding People}"
    AddNewItemCommand="{Binding AddNewPersonCommand}"
    DeleteItemCommand="{Binding DeletePersonCommand}"
    SaveCommand="{Binding SaveCommand}"
    />

    Any help will be appreciated.  Also, if there is a better way of creating the BindingNavigation functionality within WPF, please let me know.

    Thanks in advance.
  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 26 Jul 2010 Link to this post

    Hello Kwabena,

     You need to find the IsCollection method in BindingNavigator.cs and change it to this:

    private static bool IsCollection(IEnumerable obj)
    {
        if (obj == null)
        {
            return false;
        }
        return GetEnumerableGenericArgument(obj.GetType()) != null
               && obj is IList;
    }

    Sincerely yours,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kwabena
    Kwabena avatar
    9 posts
    Member since:
    Jan 2009

    Posted 26 Jul 2010 Link to this post

    Thank you very much Yavor.  That fixed the problem.

    I do have a follow-up question.  Could you please tell me how to configure/program the BindingNavigator to use a different datasource?  I used ORM Reverse Mapping to model my database and will like to use that for my bindingnavigator.

    Thanks again.

  4. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 27 Jul 2010 Link to this post

    Hi Kwabena,

     Generally, everything of type IEnumerable<> should work for just browsing, and IList<> for adding/deleting. You'll need to tell me more about your ORM solution so that I can help you on that.

    All the best,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Kwabena
    Kwabena avatar
    9 posts
    Member since:
    Jan 2009

    Posted 02 Aug 2010 Link to this post

    I am definetely missing some obvious holes but well, I'm a newbie...And I need some help to get past this stage with the bindingnavigator and crud operations on openaccess.

    I have my form which uses {Binding...} to "call" commands.  I have code for the commands in my viewmodel class e.g.
        public ICommand AddNewAssetCategory
        {
            get;
            private set;
        }
    Also in the viewmodel class, I have the following:
            private void AddNewAssetCategory(object parameter)
            {
                AssetCat.Add(new AssetCategory());
            }
    and
            private void Save(object parameter)
            {
                var assetCategory = parameter as AssetCategory;
                if (assetCategory != null)
                {
                    this.AssetCat.Add(assetCategory);
                }
            }
    In stepping through my code, it looks like the "parameter" object in Save(object parameter) is always null.

    Please let me know what I'm missing.

    Thanks for all your help so far.
  6. Ladislav
    Ladislav avatar
    1 posts
    Member since:
    Feb 2012

    Posted 08 Feb 2012 Link to this post

    Hello Kwabena,

    I know it is some time lost, but I would like to ask You if do You have still the project from Telerik named WPFBindingNavigator?

    I am looking for that tool? And I can´t find nothing usefull.

    Thank You very much.
Back to Top