Hi, using the bind sample from the help docs, I am binding SQL data to a XamDataGrid in hierarchical layout.
How can I add a column of checkboxes to the expanded child data?
<code>
{
// Initialize DataSet and give it a name
// Initialize the SqlConnection providing the
// connection string
new SqlConnection("Data Source=localhost;Initial " +
// Initialize the SqlCommand that contains the Select command
new SqlCommand("SELECT CustomerID, CompanyName, " +
"ContactName, ContactTitle, Address, City, PostalCode, " +
"Country, Phone\r\nFROM Customers");
// Assign the SqlConnection to the Connection property of the
// SqlCommand
// Initialize the SqlDataAdapter
// Assign the SelectCommand property to the SqlCommand that has
// been created
new SqlCommand("SELECT OrderID, CustomerID, OrderDate, " +
"RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, " +
"ShipCity, ShipRegion, ShipPostalCode, " +
"ShipCountry\r\nFROM Orders");
try
// Fill the DataSets
this.sqlDataAdapter2.Fill(this.flatData.Tables.Add("Orders"));
// Create a Data Relation between two tables
new DataRelation("hierarchy",
flatData.Relations.Add(tableRelation);
// Assign the DataSet's DefaultView to a control's data source
}
// Catch and display any exceptions that may occur
this.XamDataGrid3.DataSource = this.flatData.Tables[0].DefaultView;
</code>
<igDP:XamDataGrid x:Uid="igDP:XamDataGrid_3" x:Name="XamDataGrid3" Theme="Office2k7Blue" SelectedItemsChanged="XamDataGrid3_SelectedItemsChanged" >
Hi,
Do you mean the indeterminate state for the Checkbox control when you say "filled box"? If so, you may need to install the latest hotfix.
Copy and paste the following link into your browser's navigation bar to get to your keys and downloads (you may need to login if you have not done so already).
https://ko.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
I am binding XamDatagrid with a datatable and one of its column in of Boolean datatype.. Problem is Checkbox appears as filled box.
Can you help me for this.
Thanks inadvance.
Found it:
In XAML, add
<igEditors:ComboBoxItemsProvider x:Key="cbipRatings">
...cbobox items here
</igEditors:ComboBoxItemsProvider>
In codebehind, add this in your initialize code:
using Infragistics.Windows.Editors; //goes in using
unboundfield.Label = "Cbobox";
e.FieldLayout.Fields.Add(unboundfield);
xamComboEditorStyle.Setters.Add(itemsProviderSetter);
unboundfield.Settings.EditorStyle = xamComboEditorStyle;
You can set the editor of a Field by setting the Field.Setting.EditorStyle property to an instance of a Style that targets an editor that dervies from the ValueEditor class. You can then set properties for that editor by adding Setters to the Style.
For controls that are not editors, such as Buttons, you have to create your own Style that targets the CellValuePresenter. You can then set the Template property of the CellValuePresenter to your own ControlTemplate. The ControlTemplate defines the visual tree that the CellValuePresenter uses to display the contents of the cell.
An example of setting the EditorStyle can be found here and here
An example of creating your own ControlTemplate for the CellValuePresenter can be found here.