UWP custom control template not applied (but only in one project) - xaml

I have created a custom version of the default UWP button control template, which simply modifies the color scheme of the disabled state.
In a test project this customization is applied correctly, but in my real project it is ignored (although other custom control templates are applied correctly).
I have searched the project for TargetType="Button", hoping to discover something else that is overriding or interfering with this custom template, but there is nothing unusual; just a few style definitions that are setting properties for specific button instances.
Can anyone suggest why a custom UWP control template would be ignored or how I can debug what's causing this?

Related

How to override default WinUI 2.x styles in Blend?

Previously I had asked where to find the default styles for the WinUI 2.x controls, and was pointed to the appropriate repository in GitHub where those could be found. Thanks! However, what I really want is to be able to override some of the styles. I was expecting that I would be able to do so in Blend, but I have not been able to figure out how to do that.
For example, when I load my project in Blend and then try to edit the templates for the ContentDialog, I am offered the option to apply an existing style, but not to create a new one. I was expecting I could create a copy, which would give me the default styling as a starting point and allow me to make the small modifications I require. Regarding buttons, I was able to edit a copy of the template, but that only gave me access to the ControlTemplate where I want access to the equivalent of DefaultButtonStyle.
It has been a while since I've used Blend, so perhaps I am mis-remembering how the tool works. But in previous versions of our app I was able to generate resources that included the full styling of the controls that I was using, such as buttons and content dialogs. Can I do the same for our current app that uses WinUI 2.x? If so, how? And if not, what are my alternatives? I have considered copying the default templates I am interested in into the resources of my project and making modifications that way, but I am hopeful that there is a better way.
Rich
I am offered the option to apply an existing style, but not to create a new one
This is expected. For example, both the Visual Studio or the Blend for Visual Studio can't directly create a default DropDownButton style of WinUI. You need to manually copy the WinUI style from Github and put the style in your XAML.
For native UWP controls, you could just generate a copy of the style automatically.

Change ASCX file content using SiteFinity web UI

We are using Sitefinity 6.0.
We have an end user that would like to make changes to the header custom control in:
C:\inetpub\xxx\App_Data\Sitefinity\WebsiteTemplates\xxx\UserControls\Header.ascx
We would like the end user to be able to make changes to the file using the SiteFinity web, instead of opening the file in Windows and editing it directly.
Is it possible? What with Sitefinity 7.0?
There is an option to register the templates of custom controls so that they can be edited through the UI. This blog posts explains the process: http://www.sitefinity.com/blogs/slavo-ingilizovs-blog/2012/09/21/making-your-widget-templates-editable-through-the-ui.
However if you are using user controls you will not be able to use this method. This approach works with custom controls. You can find more about different types of widgets (user controls vs. custom control) here: http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/controls.
To change the html markup of the UserControl you can simply go to the File manager from the Sitefinity backend (Administration -> File Manager).
If it is codebehind code, you will need to recompile your solution, so you can't do this on the fly.
If you need to set properties, use the solution that Ben mentioned in his comment.

Better way to add custom controls to your project

There are groups of customized user-interface components, freely available for VS 2010 Express. They are called "themes". Here you have a video showing how these themes can be added to a VB project:
http://www.youtube.com/watch?v=Ec9GZaPMGqE
I would like to be able to apply a "theme" to my already existing application, but doing so would require me to manually replace all the elements in my form with the newly imported ones. Is there a better way to do this?

How to debug custom ASP.NET MVC Text Templates?

How do you go about debugging the T4 process when you are customizing the template?
I've followed the procedure in Hanselman's post to add the templates to my project so that is uses them when using the Tooling Dialog but how to I debug that template when it uses it? The documentation here and here is not really helpful since I've cleared out the Custom Tool property.
For example, I'm trying to customize the List.tt and I'd like to loop through the properties of the Model inside the Index method. I'd like to have a look at what's hanging off the Model object, etc.
My current process is edit the List.tt, right-click on controllers folder, add Controllers, enter the name, select my model, choose 'Overwrite xxxController.cs' and then check to see if what I did worked. This is extremely tedious.
Why not put the custom tool property back in to be able to rapidly test it? then take it out when you are happy?
another option is to write a .tt file that consumes/includes that .tt to operate as your REPL harness

How to add a button to the main toolbar in Eclipse programmatically

I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button.
Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.
I've just found this:
There might be layout problems with this approach. I also don't
believe the framework will try and re-create your dynamic item except
at random toolbarmanager updates. With Menus they can be updated on an
SWT.Show event, which is why CompoundContributionItem only applies to
Menus.
What shall I do? Can I say Sorry, there is no way to build toolbar dynamically. I can do it just for menus? Collegue says, that it must be possible, but he does neither know how.
The only way to be able to create main toolbar entries programmatically is in an RCP app, where you supply the ActionBarAdvisor for the workbench window. This isn't dynamic, however, just called on window creation.
Another way to do it would be to use org.eclipse.ui.menus and contribute org.eclipse.ui.menus.ExtensionContributionFactory. It also works only on workbench window creation (not really dynamic), but you could read your own XML and provide IContributionItems for the main menu or toolbar.
How dynamic are you trying to be? Most solutions work well on startup/window creation.
PW
Whenever you try to do something programmatically in Eclipse that is normally done through plugin definitions you are walking on thin ice. I've tried it on a few occasions and it rarely ended up being easy or good.
Instead, think of what it is that you only know at runtime and need to be able to change on the fly. Is it the name or icon of the button? That can be changed at runtime.
Take a look at runtime commands, they can be confusing to define properly, but with them you can for example create buttons that are only visible if a condition is active. That condition could be set at runtime.