data binding - WPF DataGrid to BindingList not working, never shows results -
I am trying to bind data to a datagrid via a property and then change that property later (Sorting) results in datagrid
I initially tied the DataGrid:
Binding List & lt; Bookings & gt; TourBookings; Private Ascend Free Pageframe_loaded_1 (Object Sender, Routing Avenger ARG E) {TourBuying = New Binding List & lt; Bookings & gt; (Waiting Datamanager Bookings Reef Gatebooking Headers (Pages, Current Page.) Tour Bookings); DgBookings.DataContext = TourBuying;} There is nothing in the DataGrid at this point, Either way I have a method:
Private async zero DataGrid_Sorting_1 (object sender, DataGridSortingEventArgs e) {tourbooking = new binding list & lt; booking & gt; ((Datamizer Bookings Reef GateBooking Headers (S, ACC, Pages, current page)). Bookings;} .. There is still no result in my datagrid ...
Where are my results? DataGrid x: name = "dgBookings" DataContext = "{binding path = tourbooking}" style = "{StaticResource DataGridStyle}" AutoGenerateColumns = "False" CanUserAddRows = "False" ScrollViewer.PanningMode = "VerticalOnly" ScrollViewer.VerticalScrollBarVisibility = "Auto" ScrollViewer.CanContentScroll = "True" ScrollViewer.PanningDeceleration = "5" ScrollViewer.PanningRatio = "1" Grid. RowSpan = "2" Grid.Row = "1" roeded ending = "Data Grid_Raude Ending_1" CanUserSortColumns = "True" Sorting = "Data Grid CRTing 1" & gt; & Lt; DataGrid.Columns & gt; & Lt; DataGridTemplateColumn Width = "*" SortMailbar = "Time" Ordering = "Ascent" & gt; & Lt; DataGridTemplateColumn.Header & gt; Time & lt; / DataGridTemplateColumn.Header & gt; & Lt; DataGridTemplateColumn.CellTemplate & gt; & Lt; DataTemplate & gt; & Lt; Text block text = "{binding start time, string format = hh: mm}" /> & Lt; / DataTemplate & gt; & Lt; /DataGridTemplateColumn.CellTemplate> & Lt; / DataGridTemplateColumn & gt; & Lt; DataGridTemplateColumn Width = "*" SortMaberPath = "Touried" & gt; & Lt; DataGridTemplateColumn.Header & gt; Tour ID 1 & lt; / DataGridTemplateColumn.Header & gt; & Lt; DataGridTemplateColumn.CellTemplate & gt; & Lt; DataTemplate & gt; & Lt; Text block text = "{binding tourid}}" & gt; & Lt; / DataTemplate & gt; & Lt; /DataGridTemplateColumn.CellTemplate> & Lt; / DataGridTemplateColumn & gt; Close the load of ..... and other properties and then the datagrid crawls etc.
< P> Binding works only with public properties, your tourkooking is just one area. Binding List & lt; Bookings & gt; Tourbookings {get; Set;} Edit:
You have to set itemsSource
& lt; DataGrid ItemsSource = "{Binding Path = TourBugings}" /> EDIT2:
If you set up a datacentext in your list, then your binding should look like this
& lt; DataGrid ItemsSource = "{Binding}" />
Comments
Post a Comment