本文整理汇总了C#中Graphic.AllAttributesMatch方法的典型用法代码示例。如果您正苦于以下问题:C# Graphic.AllAttributesMatch方法的具体用法?C# Graphic.AllAttributesMatch怎么用?C# Graphic.AllAttributesMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphic
的用法示例。
在下文中一共展示了Graphic.AllAttributesMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToDataSource
internal static void AddToDataSource(this IEnumerable itemsSource, Graphic graphic, Type objectType)
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
if (!graphic.AllAttributesMatch(objectType)) // A graphic element added with no matching attributes
{
if (objectType != null)
{
FieldInfo[] fieldInfo = GetFieldInfo(objectType);
foreach (FieldInfo fldInfo in fieldInfo)
{
Type fldType = fldInfo.FieldType;
string fldName = fldInfo.Name.Substring(1);
object defaultValue = fldType.IsValueType ? Activator.CreateInstance(fldType) : null;
dictionary.Add(fldName, defaultValue);
}
}
}
else // A graphic object from the graphics layer
{
foreach (KeyValuePair<string, object> keyVal in graphic.Attributes)
{
if (_fieldMapping.ContainsKey(keyVal.Key) && !dictionary.ContainsKey(_fieldMapping[keyVal.Key]))
dictionary.Add(_fieldMapping[keyVal.Key], keyVal.Value);
}
}
if (objectType != null)
AddToEnumerable(objectType, graphic, itemsSource);
}
开发者ID:percipio-dk,项目名称:arcgis-silverlight-toolkit-v2.4-with-wms-authentication,代码行数:31,代码来源:DataSourceCreator.cs