タイプ 'Type' が見つかりませんでした。[ライン: 7 ポジション: 21]
データテンプレートを動的に生成しようとしています。正常に動作しますが、この属性を含めると、上記の例外が発生します。
Width="{Binding Path=ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:GridViewCell}}}"
そして完全な方法:
public DataTemplate GetTextColumnTemplate(int index)
{
string templateValue = @"
<DataTemplate
xmlns:sys=""clr-namespace:System;assembly=mscorlib""
xmlns:telerik=""http://schemas.telerik.com/2008/xaml/presentation""
xmlns=""http://schemas.microsoft.com/client/2007""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
<StackPanel>
<TextBox Width=""{Binding Path=ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:GridViewCell}}}"" Text=""{Binding Path=V" + (index + 1).ToString() + @",Mode=TwoWay}"" AcceptsTab=""True"" AcceptsReturn=""True""/>
</StackPanel>
</DataTemplate>";
return (DataTemplate)XamlReader.Load(templateValue);
}