示例#1
0
        /// <summary>
        /// Creates the content control for the cell.
        /// </summary>
        /// <remarks>
        /// The control returned may be reused for other cells, so it is ideal to use MVVM data binding using
        /// BindDataContext()
        /// methods of your controls.
        /// This should return the same control for each row, otherwise the incorrect control may be shown on certain cells.
        /// </remarks>
        /// <param name="args">Cell arguments.</param>
        public override Control OnCreate(CellEventArgs args)
        {
            if (ItemBinding == null)
            {
                return(null);
            }
            var dropDown = new DropDown();

            dropDown.ShowBorder      = false;
            dropDown.ItemTextBinding = ItemTextBinding;
            dropDown.ItemKeyBinding  = ItemKeyBinding;
            if (ItemsBinding != null)
            {
                dropDown.BindDataContext(c => c.DataStore, ItemsBinding);
            }
            dropDown.SelectedValueBinding.BindDataContext(ItemBinding);
            return(dropDown);
        }