This question is locked. New answers and comments are not allowed.
Hi
I'm trying to use a celltemplateselector in my gridview but am receiving the error:
No matching constructor found on type 'Bass.Helpers.MyTemplateSelector'.
Could anybody please help me here, since this is driving me nuts. I can't see what I'm doing wrong.
I'm using this in xaml:
xmlns:local="clr-namespace:Bass.Helpers"
(in grid.resources) :
<local:MyTemplateSelector x:Key="templateSelector">
<local:MyTemplateSelector.Deleted>
<DataTemplate>
<TextBlock Text="{Binding}"
TextDecorations="Strikethrough"/>
</DataTemplate>
</local:MyTemplateSelector.Deleted>
<local:MyTemplateSelector.Normal>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</local:MyTemplateSelector.Normal>
</local:MyTemplateSelector>
(in my gridview):
<telerik:GridViewDataColumn CellTemplateSelector="{StaticResource templateSelector}" UniqueName="GlobalizedDescription.Dutch" Header="{Binding Path=stringResources.lblCommitteeName, Source={StaticResource LocalizedStrings}}" DataMemberBinding="{Binding GlobalizedDescription.Dutch}"></telerik:GridViewDataColumn>
i have a class in my namespace Bass.Helpers defined as follows:
class MyTemplateSelector : DataTemplateSelector
{
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
if (item is Bass.Web.DataModel.Committee)
{
Bass.Web.DataModel.Committee committee = item as Bass.Web.DataModel.Committee;
if (committee.Deleted == true)
{
return Deleted;
}
else
{
return Normal;
}
}
return null;
}
public DataTemplate Deleted { get; set; }
public DataTemplate Normal { get; set; }
}
I'm trying to use a celltemplateselector in my gridview but am receiving the error:
No matching constructor found on type 'Bass.Helpers.MyTemplateSelector'.
Could anybody please help me here, since this is driving me nuts. I can't see what I'm doing wrong.
I'm using this in xaml:
xmlns:local="clr-namespace:Bass.Helpers"
(in grid.resources) :
<local:MyTemplateSelector x:Key="templateSelector">
<local:MyTemplateSelector.Deleted>
<DataTemplate>
<TextBlock Text="{Binding}"
TextDecorations="Strikethrough"/>
</DataTemplate>
</local:MyTemplateSelector.Deleted>
<local:MyTemplateSelector.Normal>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</local:MyTemplateSelector.Normal>
</local:MyTemplateSelector>
(in my gridview):
<telerik:GridViewDataColumn CellTemplateSelector="{StaticResource templateSelector}" UniqueName="GlobalizedDescription.Dutch" Header="{Binding Path=stringResources.lblCommitteeName, Source={StaticResource LocalizedStrings}}" DataMemberBinding="{Binding GlobalizedDescription.Dutch}"></telerik:GridViewDataColumn>
i have a class in my namespace Bass.Helpers defined as follows:
class MyTemplateSelector : DataTemplateSelector
{
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
if (item is Bass.Web.DataModel.Committee)
{
Bass.Web.DataModel.Committee committee = item as Bass.Web.DataModel.Committee;
if (committee.Deleted == true)
{
return Deleted;
}
else
{
return Normal;
}
}
return null;
}
public DataTemplate Deleted { get; set; }
public DataTemplate Normal { get; set; }
}