Skip to content

Commit

Permalink
Revert formatting changed in ItemsControl
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Jun 16, 2022
1 parent f0b12a1 commit 0fbf896
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Framework/Framework/Controls/ItemsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,23 @@ private static ParameterExpression CreateIndexBindingExpression(DataContextStack

protected IBinding GetIndexBinding(IDotvvmRequestContext context)
{
var binding = GetValueRaw(Internal.CurrentIndexBindingProperty) as IBinding;
if (binding == null)
var result = GetValueRaw(Internal.CurrentIndexBindingProperty) as IBinding;
if (result is {})
{
return result;
}
else
{
// slower path: create the _index binding at runtime and cache it
var bindingService = context.Services.GetRequiredService<BindingCompilationService>();
var dataContext = GetDataSourceBinding().GetProperty<CollectionElementDataContextBindingProperty>().DataContext;
binding = bindingService.Cache.CreateCachedBinding(
"_index", new object[] { dataContext },
() => new ValueBindingExpression<string>(bindingService, new object?[] {
return bindingService.Cache.CreateCachedBinding("_index", new object[] { dataContext }, () =>
new ValueBindingExpression<string>(bindingService, new object?[] {
dataContext,
new ParsedExpressionBindingProperty(CreateIndexBindingExpression(dataContext))
}));
}

return binding;

}
}
}

0 comments on commit 0fbf896

Please sign in to comment.