Greetings,
I have a unique situation where I have a grid that needs a check box that is used for a separate function that does something outside the grid (just need to pass it information from the selected rows). Also, selecting a grid row sets up data on another grid. I tried using the GridViewCheckBoxColumn. However, I found selecting a row also selects or deselcts the checkbox. Not the interface I was looking for. To get around this and the separate the two , I substituted this column type for a custom column type as follows:
I have the grid bound to a custom class defined as follows:
The grid seems to work fine, but I need to do two things with it when trying to make a call to the separate function. The first is to get a count of all the checkboxes that are checked. The second is to only retrieve the data from the rows that do have their checkboxes checked. What would be the correct way of doing this as I am using a cell template in this scenario?
Thanks
I have a unique situation where I have a grid that needs a check box that is used for a separate function that does something outside the grid (just need to pass it information from the selected rows). Also, selecting a grid row sets up data on another grid. I tried using the GridViewCheckBoxColumn. However, I found selecting a row also selects or deselcts the checkbox. Not the interface I was looking for. To get around this and the separate the two , I substituted this column type for a custom column type as follows:
<
telerik:GridViewColumn
Header
=
"Request a Copy"
HeaderTextAlignment
=
"Center"
TextAlignment
=
"Center"
UniqueName
=
"colReqInvc"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
CheckBox
x:Name
=
"RCINvcChkBox"
IsChecked
=
"False"
HorizontalAlignment
=
"Center"
DataContext
=
"{Binding Path=SelectedItem, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
I have the grid bound to a custom class defined as follows:
Public
Class
ViewAllInvoice
Implements
INotifyPropertyChanged
Private
_selectedItem
As
Boolean
Public
Event
PropertyChanged
As
PropertyChangedEventHandler
Implements
INotifyPropertyChanged.PropertyChanged
Public
Property
TranID
As
String
Public
Property
TranDate
As
String
Public
Property
TranAmt
As
Decimal
Public
Property
Balance
As
Decimal
Public
Property
DueDate
As
String
Public
Property
DiscAmt
As
Decimal
Public
Property
PmtTermsID
As
String
Public
Property
InvcCmnt
As
String
Public
Property
InvcKey
As
Int32
'Property that will hold the value of checkboxes on the grid
'and also wired up to detected the property changed.
Public
Property
SelectedItem
As
Boolean
Get
Return
_selectedItem
End
Get
Set
(
ByVal
value
As
Boolean
)
_selectedItem = value
OnPropertyChanged(
New
PropertyChangedEventArgs(
"SelectedItem"
))
End
Set
End
Property
Public
Sub
OnPropertyChanged(
ByVal
e
As
PropertyChangedEventArgs)
If
PropertyChangedEvent IsNot
Nothing
Then
RaiseEvent
PropertyChanged(
Me
, e)
End
If
End
Sub
End
Class
The grid seems to work fine, but I need to do two things with it when trying to make a call to the separate function. The first is to get a count of all the checkboxes that are checked. The second is to only retrieve the data from the rows that do have their checkboxes checked. What would be the correct way of doing this as I am using a cell template in this scenario?
Thanks