本文整理汇总了C#中DataBinding.ReplaceIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DataBinding.ReplaceIndex方法的具体用法?C# DataBinding.ReplaceIndex怎么用?C# DataBinding.ReplaceIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBinding
的用法示例。
在下文中一共展示了DataBinding.ReplaceIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplaceIndexCreatesANewInstanceWithTheNewIndex
public void ReplaceIndexCreatesANewInstanceWithTheNewIndex()
{
DataBinding oldBinding = new DataBinding(42, "path");
DataBinding newBinding = oldBinding.ReplaceIndex(23);
Assert.AreNotSame(oldBinding, newBinding);
Assert.AreEqual("path", newBinding.Path);
Assert.AreEqual(23, newBinding.Index);
}
示例2: ResolveBinding
private ResolvedBinding ResolveBinding(DataBinding binding)
{
var resolvedBinding = binding as ResolvedBinding;
if (resolvedBinding != null && resolvedBinding.DataSetInfo.IsOwnedBy(this))
return resolvedBinding;
int? externalIndex = binding.Index;
if (!externalIndex.HasValue)
{
foreach (IDataSet dataSet in DataSets)
if (dataSet.CanBind(binding))
return new ResolvedBinding(lookupTable[dataSet], binding, null);
}
else
{
DataBinding nullIndexBinding = null;
int currentOffset = 0;
foreach (IDataSet dataSet in DataSets)
{
int currentColumnCount = dataSet.ColumnCount;
DataBinding currentBinding;
if (currentOffset == 0)
{
currentBinding = binding;
}
else
{
int internalIndex = externalIndex.Value - currentOffset;
if (internalIndex < 0 || internalIndex >= currentColumnCount)
{
if (nullIndexBinding == null)
nullIndexBinding = binding.ReplaceIndex(null);
currentBinding = nullIndexBinding;
}
else
{
currentBinding = binding.ReplaceIndex(internalIndex);
}
}
if (dataSet.CanBind(currentBinding))
return new ResolvedBinding(lookupTable[dataSet], currentBinding, binding.Index);
currentOffset += currentColumnCount;
}
}
return null;
}
示例3: TranslateBinding
private DataBinding TranslateBinding(DataBinding binding)
{
string path = binding.Path;
int? index;
if (path != null && indexAliases.TryGetValue(path, out index))
return binding.ReplaceIndex(index);
return binding;
}