or
Class
MainWindow
Private
Colours
As
String
()
Public
Sub
New
()
' This call is required by the designer.
InitializeComponent()
Colours =
New
String
(1) {}
Colours(0) =
"Yellow"
Colours(1) =
"Green"
' Add any initialization after the InitializeComponent() call.
RadGridView1.ItemsSource = BindData()
End
Sub
Public
Function
BindData()
Dim
dtTemp_Start
As
New
DataTable
If
Not
dtTemp_Start.Columns.Count > 0
Then
Dim
column
As
DataColumn =
New
DataColumn
column.DataType = System.Type.
GetType
(
"System.Int32"
)
With
column
.AutoIncrement =
True
.AutoIncrementSeed = 1
.
ReadOnly
=
True
.Unique =
True
.ColumnName =
"Auto_ID"
End
With
dtTemp_Start.Columns.Add(column)
dtTemp_Start.Columns.Add(
"tType"
,
GetType
(
String
))
dtTemp_Start.Columns.Add(
"Expression"
,
GetType
(
String
))
Dim
sDataRow
As
DataRow
sDataRow = dtTemp_Start.NewRow()
sDataRow(1) =
"black"
sDataRow(2) =
"bbk"
dtTemp_Start.Rows.Add(sDataRow)
' dtTemp.Columns.Add("VarCollection", GetType(ObservableCollection(Of SimulationVariableInfo)))
'dtTemp_Start.Columns.Add("ConditionCollection", GetType(clsCondCollection))
End
If
Return
dtTemp_Start
End
Function
Private
Sub
RadGridView1_BeginningEdit(
ByVal
sender
As
System.
Object
,
ByVal
e
As
Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs)
Handles
RadGridView1.BeginningEdit
DirectCast
(
Me
.RadGridView1.Columns(
"tType"
), GridViewComboBoxColumn).ItemsSource = Colours
End
Sub
End
Class
<
telerik:RadGridView
IsFilteringAllowed
=
"False"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"false"
HorizontalAlignment
=
"Left"
Margin
=
"0,67,0,0"
Name
=
"RadGridView1"
VerticalAlignment
=
"Top"
Height
=
"207"
Width
=
"503"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding Auto_ID}"
/>
<
telerik:GridViewComboBoxColumn
Header
=
"Type"
DataMemberBinding
=
"{Binding tType}"
>
</
telerik:GridViewComboBoxColumn
>
<
telerik:GridViewDataColumn
Header
=
"Expression"
DataMemberBinding
=
"{Binding Expression}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
public
PageStart()
{
Thread.CurrentThread.CurrentCulture =
new
CultureInfo(
"es-ES"
);
Thread.CurrentThread.CurrentUICulture =
new
CultureInfo(
"es-ES"
);
InitializeComponent();
}
<telerik:RadMenuItem Header="New Account" Command="{Binding ShowView}" CommandParameter="NewAccount">
<
UserControl
x:Class
=
"ABC.APP.ProfileWpf.ChartControl"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"300"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
>
<
Grid
>
<
telerik:RadChart
Margin
=
"0"
Name
=
"mChartControl"
>
<
telerik:RadChart.DefaultSeriesDefinition
>
<
telerik:Bar3DSeriesDefinition
/>
</
telerik:RadChart.DefaultSeriesDefinition
>
<
telerik:RadChart.DefaultView
>
<
telerik:ChartDefaultView
>
<
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartLegend
Name
=
"legend"
/>
</
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartDefaultView.ChartArea
>
<
telerik:ChartArea
LegendName
=
"legend"
DimensionMode
=
"Strict3D"
>
<
telerik:ChartArea.Extensions
>
<
telerik:CameraExtension
/>
</
telerik:ChartArea.Extensions
>
</
telerik:ChartArea
>
</
telerik:ChartDefaultView.ChartArea
>
</
telerik:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
</
telerik:RadChart
>
</
Grid
>
and the code where I pass the marker shape looks like this:
mChartControl.DefaultView.ChartArea.Legend.LegendItemMarkerShape = value;
I am using VS2010 and the weird thing here is if I let the code run without inspecting the object in the QuickWatch
Dialog then it will exception with the error "Object reference not set to an instance of an object.". If I
go ahead and inspect the mChartControl object and drill all of the way down to the Lengend object the Legend
object will show "+Legend{Telerik.Windows.Controls.Charting.ChartLegend Header: Items.Count:0}" that it does
exist and the code will run as it should without exception, but if I just do a hover over the string in the
IDE the Legend oject will show a value of NULL and will exception. Please let me know what is going on here
and what can be done to correct this. Thanks for your help out there.