Hi, I have a problem with my gridview, I don't know why Binding works in some columns but not in other. This is my xaml:
<
UserControl
x:Class
=
"CarriersManager"
xmlns:local
=
"clr-namespace:Dalessio_Logistics"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys
=
"clr-namespace:System;assembly=mscorlib"
mc:Ignorable
=
"d"
d:DesignHeight
=
"500"
d:DesignWidth
=
"1100"
Background
=
"White"
>
<
StackPanel
Margin
=
"0,0,0,0"
Height
=
"auto"
HorizontalAlignment
=
"Stretch"
>
<
StackPanel
x:Name
=
"panelTitle"
Height
=
"50"
VerticalAlignment
=
"Top"
DockPanel.Dock
=
"Top"
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
>
<
telerik:Label
Content
=
"Gestione operatori:"
/>
</
StackPanel
>
<
StackPanel
x:Name
=
"spContent"
>
<
telerik:RadGridView
x:Name
=
"gridCarriers"
AutoGenerateColumns
=
"False"
CanUserInsertRows
=
"False"
CanUserDeleteRows
=
"False"
RowIndicatorVisibility
=
"Collapsed"
IsFilteringAllowed
=
"True"
ShowGroupPanel
=
"False"
IsReadOnly
=
"False"
Height
=
"{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
SelectionMode
=
"Single"
CanUserReorderColumns
=
"False"
FontFamily
=
"Source Sans Pro Semibold"
FontSize
=
"14"
GridLinesVisibility
=
"Horizontal"
RowHeight
=
"45"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
x:Name
=
"Carrier"
UniqueName
=
"Carrier"
Header
=
"Carrier"
IsReadOnly
=
"True"
Width
=
"150"
DataMemberBinding
=
"{Binding Carrier}"
/>
<
telerik:GridViewDataColumn
x:Name
=
"CompanyName"
Header
=
"CompanyName"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding CompanyName}"
Width
=
"*"
/>
<
telerik:GridViewCheckBoxColumn
Header
=
"Attivo"
Width
=
"100"
DataMemberBinding
=
"{Binding Attivo}"
IsReadOnly
=
"True"
/>
<
telerik:GridViewColumn
Header
=
"Attiva"
Width
=
"80"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
x:Name
=
"btPiù"
CommandParameter
=
"{Binding Carrier}"
Content
=
"+"
Click
=
"btPiù_Click"
TouchDown
=
"btPiù_Click"
Background
=
"#FF97DA7E"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
<
telerik:GridViewColumn
Header
=
"Disattiva"
Width
=
"80"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
x:Name
=
"btMeno"
CommandParameter
=
"{Binding Carrier}"
Content
=
"{Binding Carrier}"
Click
=
"btMeno_Click"
TouchDown
=
"btMeno_Click"
Background
=
"#FFEC6F6F"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
StackPanel
>
</
StackPanel
>
</
UserControl
>
this is my vb:
Private
Sub
UserControl_Loaded(sender
As
Object
, e
As
RoutedEventArgs)
Handles
Me
.Loaded
Dim
dt
As
New
DataTable
Using sqlCon =
New
SqlConnection(ConnectionStringRemote)
sqlCon.Open()
Dim
cmd =
New
SqlCommand(
""
, sqlCon)
cmd.CommandText = "SELECT MA_Carriers.Carrier, MA_Carriers.CompanyName, ISNULL(STRT_CarriersManager.Activated,0) AS Attivo
FROM STRT_CarriersManager RIGHT OUTER JOIN
MA_Carriers ON STRT_CarriersManager.Carrier = MA_Carriers.Carrier WHERE MA_Carriers.Disabled=0"
Dim
sda =
New
SqlDataAdapter(cmd)
sda.Fill(dt)
gridCarriers.ItemsSource = dt
End
Using
End
Sub
And this is the result:
As you can see the content of the green button is empy, and also the commandparameter is empty when I try to retrieve it. Can you help me please?
Thank you