We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Display an sfComboBox as a cell on an sfSpreadsheet?

I couldn't find an example of this? The closest I could find was setting CellStyle on a grid, but I couldn't find the equivalent CellStyle field in the sfSPreadsheet?

7 Replies

KB Kanimozhi Bharathi Syncfusion Team March 16, 2016 10:32 AM UTC

Hi  Jeffrey Kesselman,

Thank you for contacting Syncfusion Support

You can add ComboBox as a cell into the SfSpreadsheet by setting list data validation to XlsIO range in the WorkbookLoaded Event of SfSpreadsheet like the below code example,


string[] val = new string[] {"10", "20", "sample"};

spreadsheetControl.WorkbookLoaded += spreadsheetControl_WorkbookLoaded;

void spreadsheetControl_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)

{

         var range = spreadsheetControl.ActiveSheet.Range["B3"].DataValidation;

        range.ListOfValues = val;

}





Regards
Kanimozhi B


JK Jeffrey Kesselman March 17, 2016 12:53 AM UTC

I am having trouble making this work as described.  This is my code, its run by a menu click.  I have traced the code and it is all excuting bu I dont see a combobox as a result.

        private void ComboBox_Click(object sender, RoutedEventArgs e)
        {
            RowColumnIndex rci = spreadsheet.ActiveGrid.Model.Grid.CurrentCell.CellRowColumnIndex;
            string address = MakeStrRef(rci.RowIndex, rci.ColumnIndex);
            var range = spreadsheet.ActiveSheet.Range[address].DataValidation;
            range.ListOfValues = new string[] { "1", "2", "3" };
            spreadsheet.ActiveGrid.InvalidateCell(rci.RowIndex,rci.ColumnIndex);
        }

        


KB Kanimozhi Bharathi Syncfusion Team March 17, 2016 11:15 AM UTC

Hi Jeffrey,

We have checked the sample with your given code example and It works fine by adding the combo box into the cell of SfSpreadsheet. Please find the sample link below,

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CS-1247653556

If the issue still persists, please update us with the replication procedure, product version details and sample which reproduces the issue to provide you a better solution. 

Regards

Kanimozhi B



JK Jeffrey Kesselman March 18, 2016 03:56 AM UTC

I tried your example on my system and it didnt create a combo box, just a normal cell with "aa" in it.,
I've enclosed a snapshot.

This is under Windows 10,  Visual Studio 2015  Building for .NET 4.6

If you need other information just tell me where to look for it and I'll post it.

(By the way, your example included as a "using" but didnt use System.Drawing.  That created a compile error so I remov ed the using declaration.)


Attachment: addcombo_c1cb5c44.zip


JK Jeffrey Kesselman March 18, 2016 08:46 PM UTC

Additional info.  My Syncfusion dashboard says its version 13.4.0.58 and that there are no updates available.


JK Jeffrey Kesselman March 20, 2016 02:08 AM UTC

Here is the Debug output, if its useful

The thread 0x361c has exited with code 0 (0x0).
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\Users\jeffp_000\Downloads\CS-1247653556\CS\bin\Debug\SpreadsheetDemo.exe'. Symbols loaded.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'. Cannot find or open the PDB file.
Step into: Stepping over non-user code 'SpreadsheetDemo.App..ctor'
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'SpreadsheetDemo.App.InitializeComponent'
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.Tools.Wpf\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.Tools.Wpf.dll'. Module was built without symbols.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.Shared.Wpf\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.Shared.Wpf.dll'. Module was built without symbols.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.SfSpreadsheet.WPF\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.SfSpreadsheet.WPF.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero2\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\Users\jeffp_000\Downloads\CS-1247653556\CS\bin\Debug\System.Windows.Interactivity.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.SfCellGrid.WPF\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.SfCellGrid.WPF.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.SfGridCommon.WPF\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.SfGridCommon.WPF.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.XlsIO.Base\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.XlsIO.Base.dll'. Module was built without symbols.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Syncfusion.Compression.Base\v4.0_13.4460.0.53__3d67ed1f87d44c89\Syncfusion.Compression.Base.dll'. Module was built without symbols.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CLIENTDIAGNOSTICS\XAMLDIAGNOSTICS\x86\WpfXamlDiagnosticsTap.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC\Microsoft.VisualStudio.OLE.Interop\7.1.40304.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.OLE.Interop.dll'. Module was built without symbols.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Luna\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Luna.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsFormsIntegration\v4.0_4.0.0.0__31bf3856ad364e35\WindowsFormsIntegration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SpreadsheetDemo.vshost.exe' (CLR v4.0.30319: SpreadsheetDemo.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemCore\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
System.Windows.Data Error: 40 : BindingExpression path error: 'Color' property not found on 'object' ''SfSpreadsheet' (Name='spreadsheet')'. BindingExpression:Path=Color; DataItem='SfSpreadsheet' (Name='spreadsheet'); target element is 'Rectangle' (Name=''); target property is 'Fill' (type 'Brush')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=spreadsheetControl'. BindingExpression:(no path); DataItem=null; target element is 'MainWindow' (Name=''); target property is 'DataContext' (type 'Object')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=spreadsheetControl'. BindingExpression:(no path); DataItem=null; target element is 'StackPanel' (Name='ZoomSilderPanel'); target property is 'DataContext' (type 'Object')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=spreadsheetControl'. BindingExpression:Path=ActiveSheet.Zoom; DataItem=null; target element is 'Slider' (Name='ZoomSlider'); target property is 'Value' (type 'Double')
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='Office2013HighlightedForegroundBrush'
The thread 0x1100 has exited with code 0 (0x0).
The thread 0x2f34 has exited with code 0 (0x0).
The thread 0x3b70 has exited with code 0 (0x0).
The thread 0x3db8 has exited with code 0 (0x0).
The program '[9660] SpreadsheetDemo.vshost.exe' has exited with code 0 (0x0).


KB Kanimozhi Bharathi Syncfusion Team March 21, 2016 10:27 AM UTC

Hi Jeffrey,

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards
Kanimozhi B

Loader.
Live Chat Icon For mobile
Up arrow icon