c# - Why is a ArgumentOutOfRangeException being thrown when datatemplate is not the current one being used -
i using data template selector, shown below: -
public class exampletemplateselector : datatemplateselector { public datatemplate foo { get; set; } public datatemplate bar { get; set; } public override datatemplate selecttemplate(object item, dependencyobject container) { var foo = item footype; return foo != null ? foo : bar; } } the xaml using being: -
<mtf:detailtemplateselector foo="{staticresource foo}" bar="{staticresource bar}" x:key="baz" /> the data template foo is: -
<datatemplate x:key="foo"> <textbox text="{binding relativesource={relativesource findancestor, ancestortype={x:type usercontrol}}, path=datacontext.detailitems[2].field.value" /> </datatemplate> using following choose template: -
<contentcontrol content="{binding set}" contenttemplateselector="{staticresource baz}" /> the data template bar case when know detailitems[2] go out of range use template selector return data template doesn't have parameters , returns, let's text="qux".
the display not problem , functionality working fine, i'm concerned information given me in debug output seeing exception.
why exception being thrown though datatemplate uses index not returned?
i can provide more information if necessary i'm expecting given information enough without having see data source.
Comments
Post a Comment