Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

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

$
0
0

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 ?



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>