Online sandbox has images on their custom layout controls??
Why am I unable to do that yet....or can I, and it's hidden somewhere.
Hello Steve,
I am attaching a step-by-step tutorial how to add custom layout widgets in your project.
Kind regards,
Jordan
the Telerik team
Thank you so much for that Jordan :)
Ok, SOOO...if my layout is created in my control assembly, and at the top I link in a ResourceLink to a CSS file which defines those images as embedded resources IN my assembly...same deal, that'll work?
Hello Steve,
This will work for sure, it is pure CSS. The only problem will be if the CSS linked in your control is loaded before the Sitefinity's embeded styles. In such case just use !important.
Kind regards,
Jordan
the Telerik team
Oh good, I was worried about iframe issues or something else
I'll get on it, thanks!
One more quick ! if you dont mind...
Is there some way to set that CssClass in the custom LayoutControl class? I dont see an obvious property available (I'd just like the users to not have to enter it)
Hi Steve,
You can set a CSS class for the wrapper element when you register the widget.
All the best,
Jordan
the Telerik team
Hey Jordan,
Yeah I know, I saw that in the image, the question though was can I set it in the code so the user doesn't have to do that....like I set the Layout Template Name in the SimpleView code....
Hello Steve,
ResourceClassId is a configuration property. Generally you can access it from your custom control or using a custom configuration.
Best wishes,
Ivan Dimitrov
the Telerik team
So something like this in the layout?
[ConfigurationProperty(
"ResourceClassId"
,
"CssClass=Test"
)]
Hi Steve,
You have to work with the system configurations
var t = Config.Get<ToolboxesConfig>().Toolboxes;
var res = t.Values.First().Tools.First().Value.ResourceClassId;
Best wishes,
Ivan Dimitrov
the Telerik team
Hey Ivan,
Ok, so this is what I ended up doing...
public
void
AssignToolboxIcon(
string
cssClass)
if
(
this
.IsDesignMode() ==
true
)
try
string
type =
this
.GetType().ToString();
var toolboxes = Telerik.Sitefinity.Configuration.Config.Get<ToolboxesConfig>().Toolboxes;
var layouts = toolboxes.Values.FirstOrDefault(x => x.Name ==
"PageLayouts"
);
foreach
(var config
in
layouts.Tools)
ToolboxItem tool = config.Value;
if
(tool.ControlType == type)
if
(String.IsNullOrEmpty(tool.CssClass))
tool.CssClass = cssClass;
break
;
catch
(Exception ex)
**Edit**
Something just occurred to me...
Where do I put the styling for this in my assembly such that when it's installed they all showup in the backend...
I was attaching my custom designer css in the ResourceLink control but as I was playing around I realized that style wont be coming down unless there's a control on it...