Sure, this is everything. Hope it helps someone!
public
bool
ClosePopup =
true
;
private
void
combo_findaddress_GatherInfo(
object
sender, CancelEventArgs e)
{
if
(combo_findaddress.SelectedItem ==
null
)
{
if
(combo_findaddress.Text.Length > 0)
{
var BeginSearch = FindAddress.BasicAddress(combo_findaddress.Text);
combo_findaddress.Items.Clear();
List<MAB.PCAPredictCapturePlus.CapturePlusFindItem> objectList = BeginSearch.Items.OrderBy(o => o.Type).ToList();
foreach
(var Address
in
objectList)
{
Telerik.WinControls.UI.DescriptionTextListDataItem Item =
new
Telerik.WinControls.UI.DescriptionTextListDataItem();
Item.Value = Address;
Item.Text = Address.Text;
Item.DescriptionText = Address.Description;
combo_findaddress.Items.Add(Item);
}
}
}
}
private
void
combo_findaddress_CreatingVisualListItem(
object
sender, CreatingVisualListItemEventArgs args)
{
args.VisualItem.Padding =
new
System.Windows.Forms.Padding(2);
args.VisualItem.DrawBorder =
true
;
}
private
void
combo_findaddress_VisualListItemFormatting(
object
sender, VisualItemFormattingEventArgs args)
{
args.VisualItem.Padding =
new
System.Windows.Forms.Padding(0, 3, 0, 3);
args.VisualItem.NumberOfColors = 1;
args.VisualItem.DrawBorder =
true
;
args.VisualItem.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders;
args.VisualItem.BorderBottomColor = Color.Black;
args.VisualItem.BorderBottomWidth = 1;
args.VisualItem.BorderTopWidth = 0;
args.VisualItem.BorderLeftWidth = 0;
args.VisualItem.BorderRightWidth = 0;
args.VisualItem.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
}
private
void
combo_findaddress_SelectedValueChanged(
object
sender, EventArgs e)
{
if
(combo_findaddress.SelectedValue !=
null
)
{
CapturePlusFindItem Find = combo_findaddress.SelectedItem.Value
as
CapturePlusFindItem;
RadDropDownList ListControl = sender
as
RadDropDownList;
if
(Find.Type == CapturePlusFindItemType.Postcode)
{
ListControl.Items.Clear();
var AddrList = FindAddress.AdvancedAddress(Find.Text, Find.Id);
foreach
(var Item
in
AddrList.Items)
{
Telerik.WinControls.UI.DescriptionTextListDataItem DataItem =
new
Telerik.WinControls.UI.DescriptionTextListDataItem();
DataItem.Value = Item;
DataItem.Text = Item.Text;
DataItem.DescriptionText = Item.Description;
ListControl.Items.Add(DataItem);
}
}
else
if
(Find.Type == CapturePlusFindItemType.Address)
{
combo_findaddress.CloseDropDown();
var Address = FindAddress.RetrieveResult(Find.Id).Items.FirstOrDefault() ;
FormatAddress(Address);
combo_findaddress.Text =
""
;
}
ListControl.Refresh();
}
}
private
void
ListElement_MouseDown(
object
sender, System.Windows.Forms.MouseEventArgs e)
{
RadListElement el = sender
as
RadListElement;
RadListVisualItem visualItem = el.ElementTree.GetElementAtPoint(e.Location)
as
RadListVisualItem;
CapturePlusFindItem FindItem = visualItem.Data.Value
as
CapturePlusFindItem;
if
(FindItem.Type == CapturePlusFindItemType.Address)
{
ClosePopup =
true
;
}
else
if
(FindItem.Type == CapturePlusFindItemType.Postcode)
{
ClosePopup =
false
;
}
Console.WriteLine(
"Clicked item: "
+ visualItem.Data.Text);
}
private
void
ArrowButton_Click(
object
sender, System.EventArgs e)
{
if
(combo_findaddress.DropDownListElement.IsPopupOpen)
{
ClosePopup =
true
;
}
else
{
ClosePopup =
false
;
}
}
private
void
combo_findaddress_PopupClosing(
object
sender, RadPopupClosingEventArgs args)
{
if
(!ClosePopup)
{
args.Cancel =
true
;
}
}
private
void
combo_findaddress_PopupClosed(
object
sender, RadPopupClosedEventArgs args)
{
combo_findaddress.Refresh();
}