When showing the open file dialog, I want to show up the "App,lication Links" category in the left side pane on Vista/7. Visual Studio does that too when opening project files.
How can I do this with a standard OpenFileDialog-Object in C#? I am using WPF by the way, but I don't think that matters in this case.
You need to use FileDialog.CustomPlaces. That MSDN link contains some sample code to get you going. Ultimately this is wrapping the native functionality exposed by IFileDialog::AddPlace.
Related
I am working on a project and have scoured the internet for answers on this topic but could not find a single answer, not even an open source solution.
Maybe you guys could help me out.
In visual studio you can open the database connection window by browsing View -> server explorer -> add connection. that is all well and known but what if I wanted to open that same form from code or a certain API. I cant seem to figure it out but there must be some sort of way to access this form pragmatically since its native to Visual Studio.
For all who are unsure what form I'm talking about, here's a snippet:
So my question to you is, how can I , through code, open this window? If there is nothing built into Visual Studio and C#, do you know of any open source software that accomplishes this or will I have to recreate it with a windows form application?
I think you would need to build the form yourself if you need any custom logic etc in which case you could use the ConnectionStringBuilder classes and pass the validated fields from your custom form to the relevant builder class to generate the connection string. Visit here for more information.
Microsoft also has library on nuget that you could use, although it's deprecated so use with caution. The nuget file, which you can download manually, also contains the source code so perhaps you could use this to jump start your own UI component. https://www.nuget.org/packages/DataConnectionDialog
that's a rather difficult one :
I use Sandcastle Help File Builder to produce documentation for my C# project from Visual Studio 2010. I want to make code only visible for C# but in default there are also visible pieces of code for C++ and Visual Basic as shown on the screenshot :
How can I change this ? I mean here how can I change it in project creation options to produce only an .html for C#.
You can limit the syntax examples to specific coding languages by setting the Project Properties->Help File->SyntaxFilters property.
[edit] Screenshot is below - Certain firewall filters will block the hosted image.
Quick 1 sentence summary: I wrote a demo app [download src here][1] that doesn't properly display sample data in the Visual Studio Designer and I need help.
After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF (you can see a screenshot [here][1]). The app simply downloads and displays recent news stories from the Google News RSS feed.
My first attempt at this resulted in the class called "GoogleNewsWidget." After reading about the MVVM model, however, I tried again and built "GoogleNewsWidget2" that attempts to utilize a more MVVM-oriented architecture. I'm not sure which implementation is best as they both seem to be working fine on the whole (and though I'd appreciate comments on which is better, it is not my primary question).
My main problem is that neither play very well with the Visual Studio Designer. The GoogleNewsWidget2 loads and displays data fine when its xaml is opened directly but does not display correctly when embedded into another xaml file . The GoogleNewsWidget does not display data in the Designer in either case.
Any help would be appreciated. Again, the source is available for download [here][1].
Thanks,
Jon
[1]: http://abstract.cs.washington.edu/~jfroehli/reflect/ Demo App Source Code
PS My original post had multiple hyperlinks to screenshots but its posting was denied by StackOverflow for spam prevention reasons. Thus, I created the [1] url, which contains screenshots and a link to source code. If someone could also help me figure out how to use the "Markdown" language for linking, I'd be grateful. :)
Assuming that the VS2010 designer works the way Blend 3 does, you have to provide "dummy" data -- the designer won't pull data from external sources.
Create an object that implements the same interface as your datasource (view model) and fill it with static data. Make sure it has a public, no-arg constructor.
Define it as a resource in your control, giving it a key like "DesignData".
In the root element of your control, add the attribute d:DataContext={DynamicResource DesignData}"
This will be used as the DataContext only when in the designer.
I'm looking for some template examples, such as a C# windows dialog.
Do many hackers take advantage of template files?
There are times when I'm creating dialog forms that are very similar. I want to make all my forms look and behave consistently, without doing a lot of coping and pasting.
Add New Item -> My Templates
Here's an article on creating your own Project and Project Item templates:
Create Reusable Project And Item Templates For Your Development Team
Much cooler, but not exactly what you asked for is T4 (text template transformation toolkit) that allow you to do intelligent code generation during builds. Take a look at this MSDN article for more info:
Generating Artifacts By Using Text Templates
Make the template yourself, from the first dialog you made. This will avoid the problem of having to search for a template that does exactly what you want.
There are lots of C# code snippets around. They will provide scaffolding for different structures (properties, dispose pattern and more).
Here is one source.
I want to create a .NET Form at runtime, add buttons and other controls to that (also at runtime), and then be able to generate a something.designer.cs file from that form (which can then be added to a C# solution and compiled).
What I want to do is very similar to what the WinForm designer does. But instead of having a drag/drop interface for the user, I want to dynamically build the Form/Controls myself at runtime.
I was thinking I could just reuse what the WinForm designer is doing.
Is that possible?
This MSDN magazine article should have everything you need.
It's really not as simple as it was pre-.NET as the visual version of the form you see in Visual Studio is actually the result of multiple files.
But in the simplest form you could simply just mirror what .NET does at the start of creating a new form:
Create three files Form.cs, Form.Designer.cs and Form.resx (which is an XML file).
Place the same default content in them that VS does
Mimic the code generated when adding controls, code-behind and resources
It will be a tedious task, but it can be done. Adding resources however will be burdensome.
Yes, you can do achieve this using Compiler Services (compiling c# code) or Emit class if you know building correct MSIL.