Better way to add custom controls to your project - vb.net

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?

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.

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

Inspecting XAML in Windows 8 Store Apps / VS2012

I'm looking for a way to inspect running XAML in a Windows 8 store app. Essentially, I want firebug / chrome inspector style functionality where I can look at the XAML source generated at runtime, to debug simple layout and style issues.
I've tried Snoop, Pistachio and WPF Inspector but none work for Windows Store apps. The only one I can find which seems to work for Store apps is XAML Spy, which is €90. I can't justify that cost.
Is there any other way to inspect running XAML?
WinRT XAML Toolkit now has an actual visual - visual tree debugger.
Get it from NuGet: nuget.org/packages/winrtxamltoolkit.Debugging then call WinRTXamlToolkit.Debugging.DC.ShowVisualTree() to display the debugger tool inside of your app. It's the third option so now you can use
the WinRTXAMLToolkit.Debugging.VisualTreeDebugger class - that enables you to debug the tree in your Visual Studio
XAML Spy - which is a great commercial visual tree debugger that runs in a separate window
and now this visual tree debugger in the WinRT XAML Toolkit that works inside of your app.
The VisualTreeDebugger class from WinRT XAML Toolkit is what you could use if you want a free tool. It doesn't do as much as XAML Spy, but you get what you pay for. I thought of adding more features to it like actual visualization of what you debug, but the work required would not justify the time investment + I didn't want to step on Koen Zwikstra's turf. I am sure he is doing a great job on that tool. Anyways - VisualTreeDebugger is enough for me, so maybe it would also be enough for you.
The way you can use it is add the class to your code, add a reference in your XAML like
xmlns:debug="WinRTXamlToolkit.Debugging"
then put a hook on a control where you would like to start debugging, like
debug:VisualTreeDebugger.BreakOnLoaded="True"
which will dump the core visual tree details as text in your debugger output window (Ctrl+W,O) and break in the code that dumped your tree where you can investigate the "path" variable, which contains the list of all visual tree elements from the debugged control to the root, so you can watch their values if what you need wasn't already dumped in the output window.
Other options include
debug:VisualTreeDebugger.BreakOnTap="True"
debug:VisualTreeDebugger.BreakOnLayoutUpdated="True"
debug:VisualTreeDebugger.BreakOnLoaded="True"
debug:VisualTreeDebugger.TraceOnTap="True"
debug:VisualTreeDebugger.TraceOnLayoutUpdated="True"
debug:VisualTreeDebugger.TraceOnLoaded="True"
Since it is source code and really a single simple class - you can easily add additional things to the code to do any custom debugging you need.
XAML Spy is what you need. You find it at http://xamlspy.com.
there is a new free tool called XAML Inspector. It's available through NuGet. Just search for "xamlinspector" or get if from the project page: www.xamlinspector.com
Greetings
Christian

Charts and plots in .Net 4 using Windows Form

I am using Windows Form and .Net 4 in Visual Studio 2010. I need to do some cross-plots, and would like to have a few features, as cursor and zoom in and out.
I tried to use ZedGraph, however I was not able to add its controller to the toolbox. I don't know if I have done something wrong or if it is not compatible.
Do you have any suggestions?
Thank you!
First, I'll assume you are using WinForms (as opposed to WPF).
Add references to the ZedGraph DLLs to your project
Right-click references in the solution explorer and select Add Reference
Select the browse tab and locate ZedGraph.dll (also ZedGraph.Web.dll if needed)
Rebuild the project (F6)
In the Toolbox, check that ZedGraphControl has appeared under Components
This control can be added to the design layout of a form.
Alternatively, once you have the reference added, you can add a graph to a form in code with the following:
using ZedGraph;
ZedGraphControl myZedGraphControl = new ZedGraphControl();
// set size, location, etc. properties
form1.Controls.Add(myZedGraphControl);