using System;
using System.Collections.Generic;
using System.Text;
using Ubik.Engine.Client;
using System.Windows.Forms;
namespace StoresAndStockPricing.Controls{
public class BoundComboBox : ComboBox
{
public T GetSelectedItem<T>() where T : Individual
{
object selectedItem = SelectedItem;
if (selectedItem == null)
return null;
return ((BoundComboBoxItem<T>)selectedItem).Value;
}
public void SelectItem<T>(T item)
where T : Individual
{
foreach (object o in Items)
{
if (((BoundComboBoxItem<T>)o).Value == item)
{
SelectedItem = o;
return;
}
}
}
}
}
|