Hi Guys,
I'm struggling with an issue and I can't figure why this goes wrong.
I cannot access my object in the resourcedictionary in my code behind. What I have is the following
I have a resourcedictionary like this.
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikScheduleView
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView"
xmlns:telerikColorPickers
=
"clr-namespace:Telerik.Windows.Controls.RichTextBoxUI.ColorPickers;assembly=Telerik.Windows.Controls.RichTextBoxUI"
xmlns:local
=
"clr-namespace:Proj"
xmlns:p
=
"clr-namespace:Proj.Resources"
x:Class
=
"Proj.ProductieOrderViewRecources"
>
<
DataTemplate
x:Key
=
"ProductieOrderViewToolBarTemplate"
>
<telerik:RadRichTextBoxRibbonUI x:Name="richTextBoxRibbonUI"
this whitin this resourcedictionary
I have a radgridview like this.
<
DataTemplate
x:Key
=
"ProductieOrderViewMainSectorTemplate"
>
<
Grid
Margin
=
"10"
>
<
Grid
>
<
telerik:RadBusyIndicator
x:Name
=
"BusyIndicator"
Grid.Row
=
"2"
Visibility
=
"{Binding ShowPlanning}"
>
<
telerik:RadGridView
x:Name
=
"gridViewAdminData"
ItemsSource
=
"{Binding DataRecords}"
RowEditEnded
=
"EditRecord"
DataLoading
=
"LoadData"
SelectionChanged
=
"GridSelectionChanged"
FrozenColumnCount
=
"5"
AutoGenerateColumns
=
"False"
Deleting
=
"RadGridView_deleting"
SelectedItem
=
"{Binding SelectedPlanning}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Artikel}"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Aantal}"
/>
now I'm trying the access the gridViewAdminData by name in the code behind.
but it won't work at all.
I have this in my code
public
partial
class
ProductieOrderViewRecources : ResourceDictionary
{
public
ProductieOrderViewRecources()
{
InitializeComponent();
System.Linq.Expressions.Expression<Func<Proj.Models.productieorder,
double
>> expression = order => (order.AantalTeProduceren + 10);
//RadGridView gridViewAdminData = (RadGridView)this["gridViewAdminData"];
GridViewExpressionColumn column = gridViewAdminData.Columns[
"TotalValue"
]
as
GridViewExpressionColumn;
column.Expression = expression;
}
}
but gridViewAdminData won't get recognized. Also enabling the line above gives back a null value.
Does anyone have any idea about how to access this object in the code behind?
thank you