[DEVEXPRESS/WINFORM] ListSourceDataAdapter 클래스 : 속성 매핑을 사용해 데이터 소스에서 부가 속성 값 제공하기
DevExpress/WinForm 2020. 6. 26. 20:31728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Collections.Generic;
using DevExpress.XtraEditors;
using DevExpress.XtraMap;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : XtraForm
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 빙 맵 키
/// </summary>
private string bingKey = "INPUT YOUR BING KEY";
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
this.bingMapDataProvider.BingKey = this.bingKey;
Load += Form_Load;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 폼 로드시 처리하기 - Form_Load(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Load(object sender, EventArgs e)
{
#region 소스 리스트를 설정한다.
List<StateRectangle> sourceList = new List<StateRectangle>
{
new StateRectangle { Top = 44.996250, Left = -111.049638, Width = 496, Height = 444 },
new StateRectangle { Top = 48.990004, Left = -104.042967, Width = 480, Height = 338 },
new StateRectangle { Top = 45.944326, Left = -104.042967, Width = 528, Height = 338 },
new StateRectangle { Top = 41.000038, Left = -109.049518, Width = 528, Height = 445 }
};
#endregion
#region 리스트 소스 데이터 어댑터를 설정한다.
ListSourceDataAdapter listSourceDataAdapter = new ListSourceDataAdapter();
listSourceDataAdapter.DefaultMapItemType = MapItemType.Rectangle;
listSourceDataAdapter.Mappings.Latitude = "Top";
listSourceDataAdapter.Mappings.Longitude = "Left";
listSourceDataAdapter.DataSource = sourceList;
listSourceDataAdapter.PropertyMappings.AddRange
(
new MapItemPropertyMappingBase[]
{
new MapRectangleWidthMapping { Member = "Width" , DefaultValue = 0 },
new MapRectangleHeightMapping { Member = "Height", DefaultValue = 0 }
}
);
this.vectorItemsLayer.Data = listSourceDataAdapter;
#endregion
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
댓글을 달아 주세요