Passing DataContext to page to do CRUD on WPF Toolkit DataGrid
Asked By Charles Kruger
10-Aug-10 03:22 AM
Hi all,
I have a wpf toolkit data grid on a page in my n-tier app, what I need to do is pass the DataContext to the page so that I can call the SubmitChanges function (on a save button click or lost focus event) to save all changes on my page and save it to the DB. This will really save me a lot of time(having to impliment buttons and write the methods to add/update/delete individual rows - as you can see that is not ideal to the end user either). It works fine in my classes on the Data Access layer but is there a way to pass the DataContext to another project where I would then instantiate and use it? This is my first N-tier app and would appreciate any help/advice you can supply.
Thanks,
Charles.


WPF DataGrid Custom Paging and Sorting This article shows how to implement custom paging and sorting on a WPF DataGrid. Introduction WPF DataGrid has built-in functionality for sorting its items by clicking However, it only works for the current items in the DataGrid. This becomes a problem when paging functionality is implemented. Paging for moving through the list. The data grid is a WPF DataGrid. It is not yet a released product but is downloadable from CodePlex under WPF Toolkit. Paging To implement paging, a method must be created
WPF DataGrid as ComboBox Dropdown This article describes how to display the items of a WPF ComboBox inside a DataGrid when the ComboBox is clicked. It also shows how to of a normal ComboBox, like clicking the item on the DataGrid should close the ComboBox's popup. WPF DataGrid as ComboBox Dropdown I had a WPF application wherein I want to display a list of objects the items as rows. Fortunately, I found out about the WPF DataGrid. I decided to use the DataGrid to show the items
Freeze Row Group Header in WPF DataGrid Grouping items in a WPF DataGrid can be easily achieved by using CollectionViewSource. We have the be moved out of view when the user scrolls the DataGrid horizontally. Introduction To give a brief introduction of what the example is frozen by using the FrozenColumnCount property of the DataGrid. I am not sure if having this kind of behavior run-through. We can group items in any ItemsControl object, DataGrid included. To group the items, we can create a CollectionViewSource GroupDescriptions> < PropertyGroupDescription PropertyName = "Department" / > < / CollectionViewSource.GroupDescriptions> < / CollectionViewSource > < / Window.Resources> < Grid > < DataGrid HorizontalAlignment = "Stretch" VerticalAlignment = "Stretch" ItemsSource = "{Binding Source = {StaticResource ResourceKey = EmployeesCvs}}" FrozenColumnCount = "1" CanUserAddRows = "False" RowHeaderWidth = "0"> <DataGrid.GroupStyle> < GroupStyle > <GroupStyle.ContainerStyle> < Style TargetType = "{x:Type GroupItem}"> < Setter ItemsPresenter / > < / Expander > < / ControlTemplate > < / Setter.Value> < / Setter > < / Style > < / GroupStyle.ContainerStyle> < / GroupStyle > < / DataGrid.GroupStyle> < / DataGrid > < / Grid > < / Window > Listing 1. DataGrid Grouping in XAML
WPF Datagrid as ComboBox Dropdown Part 2 This presents a WPF custom control derived from ComboBox that shows a DataGrid to display the ComboBox items. Introduction Some time ago, I article that discusses how to show ComboBox items using a DataGrid. The article shows how to change the control template of and replace the default control in the Popup with a DataGrid. It gets the job done but is not elegant, I style and control template and change the columns of the DataGrid (since you probably don’t want to show the same list of data triggers just to add or remove some DataGrid columns. We are left with creating either a user control ComboBox Before anything else, first create a project of type WPF Custom Control Library, so that things are automatically created for the Popup’s Child property to the PopupContent. Adding a DataGrid Let’s use the control in a demo application and
wpf Datagrid Row editing Hi all, i want to edit all columns will be read only. How can i set this in wpf datagrid. . Thanks . . Arif In my opinion, the easiest way to do will alter various properties in your UI. When binding in Silverlight or WPF, you are not restricted to just binding data capture properties your properties on the class implement the NotifyPropertyChanged interface, your Silverlight / WPF will dynamically adjust as class property values change. Create New
Computed Columns In WPF DataGrid hie, I want to created computed columns like ms excel in wpf customized datagrid.Can anyone suggest some idea.for eg i have datagrid in following format DataGrid Name = "dgv" Grid.Row = "1" AutoGenerateColumns = "False"> <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid Name = "grdCell"> <Grid.RowDefinitions Content = "New" Click = "btnNew_Click"> < / Button> < / Grid> < / DataTemplate> < / DataGridTemplateColumn.CellTemplate> < / DataGridTemplateColumn> < / DataGrid.Columns> < / DataGrid> there are 5 textbox with name tank1, tank2, tank3, tank4 The proper way to do this sort of thing with WPF and Silverlight is to create properties on your data class
Computed Columns In WPF DataGrid hie, I want to created computed columns like ms excel in wpf customized datagrid.Can anyone suggest some idea.for eg i have datagrid in following format DataGrid Name = "dgv" Grid.Row = "1" AutoGenerateColumns = "False"> <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid Name = "grdCell"> <Grid.RowDefinitions Content = "New" Click = "btnNew_Click"> < / Button> < / Grid> < / DataTemplate> < / DataGridTemplateColumn.CellTemplate> < / DataGridTemplateColumn> < / DataGrid.Columns> < / DataGrid> there are 5 textbox with name tank1, tank2, tank3, tank4 in textbox named total. http: / / www.infragistics.com / dotnet / netadvantage / silverlight / data-visualization / infragistics-excel.aspx#Overview Create New Account
WPF, Datagrid, fixed row number, Hi, I am using a datagrid in which I need to allow user only to add work. Hope this helps. thanks for the reply michael. But WPF datagrid doesnot have property "Items". Any other idea? :) I checked it again and DataGrid does have an Items property. It inherited it from ItemsControl Are you using WPF or Silverlight? As far as I can remember, the Silverlight version of the DataGrid does not have an Items property. I tried adding the