public IObjectContainer AddCustomObject(ICustomObject customObject, double x = 0, double y = 0) { IObjectContainer container = ParentPage.AddCustomObject(customObject); foreach (Widget widget in container.WidgetList) { // Set the created view as the current view because this is the first time when the widget // is added in the current document. widget.CreatedViewGuid = _viewGuid; // Set this flag to false. PlaceWidgetInternal method will set this flag base on checking // if this is base view. widget.HasBeenPlacedInBaseView = false; // Get widget style in this view. IWidgetStyle widgetViewStyle = widget.GetWidgetStyle(_viewGuid); // Widgets in library should have same relative location, so make them have the same delta. widgetViewStyle.X += x; widgetViewStyle.Y += y; if (widget is IHamburgerMenu) { IHamburgerMenu menu = widget as IHamburgerMenu; IHamburgerMenuButton button = menu.MenuButton; IWidgetStyle buttonViewStyle = button.GetWidgetStyle(_viewGuid); buttonViewStyle.X += x; buttonViewStyle.Y += y; } PlaceWidgetInternal(widget, true); } // Custom object doesn't contain masters, so we don't handle container.MasterList. return(container); }