Posted 6 April 2018, 1:06 am EST
How do I create combo box and multi-column combo box cells as shown on your spread.net features page? I don’t see anything in the docs about them.
Forums Home / Spread / Spread for WPF/Silverlight
Posted by: sean on 6 April 2018, 1:06 am EST
Posted 6 April 2018, 1:06 am EST
How do I create combo box and multi-column combo box cells as shown on your spread.net features page? I don’t see anything in the docs about them.
Posted 9 April 2018, 1:38 am EST
Hi Sean,
Spread for WPF/Silverlight does not have built in CellTypes like other Spread for other platforms. You can create a combobox cell by creating a custom drawing object. Here is the code to do that:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
DrawingObjectManager.SetDrawingObjectProvider(this.gcSpreadSheet1, new MyDrawingObjectProvider());
}
}
public class MyDrawingObjectProvider : IDrawingObjectProvider
{
public DrawingObject GetDrawingObjects(Worksheet sheet, int row, int column, int rowCount, int columnCount)
{
if (row == 1 && column == 1)
{
return new ControlDrawingObject { new ControlDrawingObject(row, column, new Button()) };
}
return sheet.GetDrawingObject(row, column, rowCount, columnCount);
}
}
public class ControlDrawingObject : CustomDrawingObject
{
private Control _rootElement;
public ControlDrawingObject(int row, int col, ComboBox myCombo) : base(row, col) { _rootElement = control; this.ShowDrawingObjectOnly = true; }
public override FrameworkElement RootElement
{
get { _rootElement.Margin = new Thickness(1); return _rootElement; }
}
}
I could not find a way to create a MultiColumnComboBox cell.
Sorry for the inconvenience.
Thanks,
Deepak Sharma