Sys.Preview.UI.Selector.prototype.get_selectedItem = function()
{
	var dataIndex = this.get_element().selectedIndex;
	
	if(this.get_firstItemText())
	{
		dataIndex--;
	}
	
	return dataIndex == -1 ? null : this.get_data().getItem(dataIndex);
}

Sys.Preview.UI.Selector.prototype.set_data = function(value)
{
	if(this._data
			&& 
		Sys.Preview.INotifyCollectionChanged.isImplementedBy(this._data))
	{
		this._data.remove_collectionChanged(this._dataChangedDelegate);
	}

	this._data = value;
    
	if(this._data)
    {
		if(Array.isInstanceOfType(this._data))
		{
			this._data = new Sys.Preview.Data.DataTable([], this._data);
		}
	
		this._data.add_collectionChanged(this._dataChangedDelegate);
	}

	this.dataBind();
	this.raisePropertyChanged("data");
}

Sys.Preview.UI.Selector.prototype.set_selectedValue = function(value)
{
	this.get_element().value = value;
	
	this.raisePropertyChanged("selectedValue");
    
    // Only raise event when they are selecting a valid value from the list
    if(!this._firstItemText
			||
    	this.get_element().selectedIndex > 0)
    {
		var handler = this.get_events().getHandler("selectionChanged");
    
		if(handler)
		{
			handler(this, Sys.EventArgs.Empty);
		}
	}
}