none
"DesignSource' is null" XamlParseException when DataGrid RowDetailsTemplet have a DataGrid with itemsource bindings RRS feed

  • Question

  • Hi,

    i have a s dataGrid : master and details  , the master DataGrid has a RowDetailsTemplate witch contain the details grid , so when a user select a row in the master grid , the row details will be the details grid

     <DataGrid x:Name="datagrdcustomar"
                      RowDetailsVisibilityMode="VisibleWhenSelected"
                      Margin="5"
                      ItemsSource="{Binding}"
                      EnableRowVirtualization="True"
                      AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridComboBoxColumn x:Name="personFullName"
                                            Width="*"
                                            Header="Customer Name"
                                            ItemsSource="{Binding Source={StaticResource personView}}"
                                            DisplayMemberPath="Fullname"/>
    
                </DataGrid.Columns>
    
                <DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                        <GroupBox BorderBrush="Red"
                                  BorderThickness="2"
                                  Header="Payment"
                                  Margin="70,5,5,5">
                            <DataGrid x:Name="paymentDataGrid"
                                      AutoGenerateColumns="False"
                                      EnableRowVirtualization="True"
                                      ItemsSource="{Binding Source={StaticResource customarPaymentViewSource}}"
                                      RowDetailsVisibilityMode="VisibleWhenSelected"
                                      Margin="5">
                                <DataGrid.Columns>
                                    
                                        
                                    <DataGridTextColumn x:Name="moneyColumn"
                                                        Binding="{Binding Money}"
                                                        Header="Money"
                                                        Width="100" />
    
                               </DataGrid.Columns>
    
                            </DataGrid>
                        </GroupBox>
                    </DataTemplate>
                </DataGrid.RowDetailsTemplate>
    
            </DataGrid>

    the problem is when i edit the RowDetailsTemplate (right click on the grid -> Edit Additional Templates-> edit RowDetailsTemplate -> edit current)
     the VS 2012 designer display error/exception :XamlParseException: Collection property 'System.Windows.Data.CollectionViewSource'.'DesignSource' is null.

    throw try and fails i found that removing the  ItemsSource="{Binding Source={StaticResource customarPaymentViewSource}}" of the grid in the template fix the problem ,

    my collection view sources are :

    <CollectionViewSource x:Key="customarViewSource"
                                  d:DesignSource="{d:DesignInstance {x:Type local:Customar}, CreateList=True}" />
    
            <CollectionViewSource x:Key="customarPaymentViewSource"
                                  Source="{Binding Payment, Source={StaticResource customarViewSource}}"
                                  d:DesignSource="{d:DesignInstance {x:Type local:CustomarPayment}, CreateList=True}" />

    why the exception happen and how can i fix it ?


    Wednesday, September 25, 2013 10:20 AM

Answers

  • Hi Hani,

    I've reproducted your issue in my side, refer to the link below:

    #CollectionViewSource Class
    http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(v=vs.110).aspx

    CollectionViewSource is a proxy for a CollectionView class, or a class derived from CollectionView. CollectionViewSource enables XAML code to set the commonly used CollectionView properties, passing these settings to the underlying view. CollectionViewSource has a View property that holds the actual view and a Source property that holds the source collection.

    When we specific a control's Itemsource to a CollectionViewSource in other control's template, if we manually navigate to this template, Visual Studio Designer will throw this exception.

    It seems that it is not a known issue. If it is an outstanding issue not yet reported, please do report it on the Connect website at http://connect.microsoft.com, which allows you to give feedback directly to the product group.  This approach also allows you to track the status and response on the bug once it is triaged and investigated.

    I'm sorry for any inconvenience, thank you for your understanding.

    Best Regards,
    Franklin


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Hani Safa Monday, September 30, 2013 12:08 PM
    Thursday, September 26, 2013 10:27 AM
    Moderator
  • Hi Hani,

    Thank you for your feedback.

    We can vote this bug and add comment to describe your issue, I will also contact with Dev Team through internal way.

    I'm sorry for any inconvenience, thank you for your understanding.

    Best Regards,
    Franklin


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Hani Safa Monday, September 30, 2013 12:08 PM
    Monday, September 30, 2013 10:01 AM
    Moderator

All replies

  • Hi Hani,

    I've reproducted your issue in my side, refer to the link below:

    #CollectionViewSource Class
    http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(v=vs.110).aspx

    CollectionViewSource is a proxy for a CollectionView class, or a class derived from CollectionView. CollectionViewSource enables XAML code to set the commonly used CollectionView properties, passing these settings to the underlying view. CollectionViewSource has a View property that holds the actual view and a Source property that holds the source collection.

    When we specific a control's Itemsource to a CollectionViewSource in other control's template, if we manually navigate to this template, Visual Studio Designer will throw this exception.

    It seems that it is not a known issue. If it is an outstanding issue not yet reported, please do report it on the Connect website at http://connect.microsoft.com, which allows you to give feedback directly to the product group.  This approach also allows you to track the status and response on the bug once it is triaged and investigated.

    I'm sorry for any inconvenience, thank you for your understanding.

    Best Regards,
    Franklin


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Hani Safa Monday, September 30, 2013 12:08 PM
    Thursday, September 26, 2013 10:27 AM
    Moderator
  • hi ,

    I've reported as a bug , her 

    Friday, September 27, 2013 12:43 PM
  • Hi Hani,

    Thank you for your feedback.

    We can vote this bug and add comment to describe your issue, I will also contact with Dev Team through internal way.

    I'm sorry for any inconvenience, thank you for your understanding.

    Best Regards,
    Franklin


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Hani Safa Monday, September 30, 2013 12:08 PM
    Monday, September 30, 2013 10:01 AM
    Moderator
  • hi Franklin ,

    the same bug was present in vs 2012 update 1 to 4

    and new in vs 2013

    I've re report this bug again for vs 2013 , link her

    hope you can vote for it , cause really its very annoying bug

    best regards

    Saturday, December 14, 2013 8:30 PM