My Grid Code is like below...
<igGrid:XamWebGrid InitializeRow="XamWebGrid_InitializeRow" CellEnteredEditMode="XamWebGrid_CellEnteredEditMode" ScrollViewer.VerticalScrollBarVisibility="Visible" MaxDepth="1" RowAdded="XamWebGrid_RowAdded" Height="400" Grid.Row="0" HorizontalAlignment="Left" Margin="5,5,5,5" Name="gridTransaction" VerticalAlignment="Top" AutoGenerateColumns="False"> <igGrid:XamWebGrid.Columns> <igGrid:TemplateColumn Key="StepObjectAction" HeaderText="HeaderCheckBox" HorizontalContentAlignment="Center"> <igGrid:TemplateColumn.HeaderTemplate> <DataTemplate> <CheckBox x:Name="chkAll" Checked="chkAll_Checked" Grid.Column="0" Margin="10,2,2,2" /> </DataTemplate> </igGrid:TemplateColumn.HeaderTemplate> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <CheckBox x:Name="chkBoxID" IsChecked="False" IsEnabled="True" /> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate>
</igGrid:TemplateColumn>
</igGrid:XamWebGrid.Columns>
I need to do the functionality of Select and Unselect all functionality for that
1) How to find the Datatemplate control "chkBoxID" in the code behind at runtime and on which event?
Please Suggest...
Thanks In Advance...
Hi,
Please try to post your questions once, is see you've posted the same question in three different posts.
Also, it'd probably be better to post your question in a new post, so as its easier to find:
Please see the response here:
https://es.infragistics.com/community/forums/f/retired-products-and-controls/42325/create-data-template-column-at-run-time
-SteveZ
I am creating the TextColumn at runtime and adding it to the Grid from ViewModel. I want add HeaderTemplate to TextColumn. I want to add one Button and one TextBlock to headerTemplate at runtime and for the Button I want to add an event. I am able to add the button but if i add Click Event its throwing an exception saying we can not add Event to it. I tried one more way of doing this. In the Xaml i created a DataTemplate with Button and TextBlock. and I am adding this datatemplate to Grid TextColumn HeaderTemplate. But before adding to TextColumn HeaderTemplate I want to change the TextBlock Text, I want to display the Column Name for that TextBlock. I am finding the Textblock control from the codebehind and changing its Text. But in UI its not updating the Text. Can you please help me in this. What I want is adding the HeaderTemplate to TextColumn from codebehind and that HeaderTemplate will contain one Image Button and one textBlock. Button is to open a new popupwindow and TextBlock is to display column header. Thanks In Advance
I've attached a sample to this post that shows one way to add a Checkbox to a CheckBoxColumns header and have it check/uncheck all of the items in that column.
Basically what happens is:
A couple of other notes...you will have to add the IG Grid assembly references to the project to get it to compile. Secondly, you will have to change the connection string in the Entity Model.
Let me know if you have any questions.
Devin
I checked the two way binding property in another case.
But If I take the CheckBoxColumn then its the seprate column right ?
How can I add the header into that for having checkbox? Currently what I did is on the Header checkbox checked event I am modifying the checkbox property(true/false).
But what am I doing is not a proper solution,I think.
Any suggestion?
-Pankaj
Hi Pankaj,
So, if you have a property on your data object then you can simply use our CheckBox Column which automatically is setup to be a TwoWay binding.
Your Data object should implement INotifyPropertyChanged, though, so that when you modify your proprety, the XamGrid is notified.
bool _yourProp
public bool YourProp{ get{return this._yourProp;}
set { if(this._yourProp != value) { this._yourProp = value; if(this.PropertyChanged != null) this.PropertyChanged(object, new PropertyChangedEventArgs("YourProp")); }}
Then in your Columns collection setup your Column.
<ig;CheckBoxColumn Key="YourProp"/>