Reputation: 854
we're currently migrating a very old VB 6 application to .NET 4.5 WPF. This application uses the old Farpoint Spread 7.0 component. The old spreadsheet uses CellTypeButton
extensively, but Spread for WTF doesn't provide this cell type. I also didn't find any sample code, tutorials, blogs on how to create a custom cell type for Spread in WPF.
Is it possible to create buttons in Spread for WPF? Has anyone done this before? Any tips, resources or links to smaples or blogs on how to do this?
Thank you very much!
Upvotes: 0
Views: 972
Reputation: 3353
You may use CustomFloatingObject
The following code creates a floating object.
Refer: http://helpcentral.componentone.com/NetHelp/SpreadWPF/webframe.html#floating.html
public class MyFloatingObject : GrapeCity.Windows.SpreadSheet.UI.CustomFloatingObject
{
public MyFloatingObject(string name, double x, double y, double width, double height)
: base(name, x, y, width, height)
{
}
public override FrameworkElement Content
{
get
{
Border border = new Border();
StackPanel sp = new StackPanel();
sp.Children.Add(new Button() { Content = "Button" });
border.BorderThickness = new Thickness(1);
border.BorderBrush = new SolidColorBrush(Colors.Black);
border.Child = sp;
return border;
}
}
}
To add instance of this floating object into worksheet
MyFloatingObject mf = new MyFloatingObject("mf1", 10, 10, 200, 100);
gcSpreadSheet1.ActiveSheet.FloatingObjects.Add(mf);
Upvotes: 0