Flyout for autocomplete in WinUI 3 TextBox - c#

Can anyone explain what the ProofingMenuFlyout is for in WinUI 3 on a TextBox?
The documentation for it is bare with no example on how to use it.
What I'm actually trying to do is create a popup menu much like the auto suggestion popup in the Visual Studio text editor that gives hints on methods etc. I.e. the one you can open with Ctrl+Space. I want this functionality inside a TextBox as a helper for when certain initial letters are written.
My initial though was to use some dynamic flyout that is opened from a TextChanged callback when a keyword is detected. Then I found this ProofingMenuFlyout that is rather undocumented and I can't figure out how to use, or what it is for.
Am I on the right track with using a menu flyout or should I consider some other way of doing it?

Can anyone explain what the ProofingMenuFlyout is for in WinUI 3 on a TextBox?
It is for spell checking.

Related

Create a popover-like control in C# WinForms?

So, one of my favorite things about iOS/ObjC in general is the "popover" control.
I am building an app in C# WinForms that would benefit greatly from this type of control- anyone have any ideas on how I might be able to emulate this type of look?
For reference, here's an example screenshot of what I'm talking about http://i.imgur.com/IzbbzrA.png
Thanks for any ideas!
You can create a simple popup control by following the articles linked below
Simple Popup Control
I don't think such a control exists in .Net. What I would do from this point if I were you is try to making one using a customized windows form on top of it. Play with the Mouse Hover events of the control and make the form appear for a short time. Make it without borders. With a little imagination you can have your own version of the PopOver.

Add custom item to right click menu when user selects text

I want to add a custom menu item to the menu that appears when a user selects some text and right clicks. I searched a lot but did not get any answer. Maybe I did not put in the right keyword.
Is it possible to do this?
If this is possible, I want to do this for all applications in windows whenever the user selects text. Is there a universal way to do it or will have to write code specific to the application?
I am using C#.
I don't think you can do that universally in all windows apps. But it is certainly possible to do in your own app using a popup menu.
I've also tried a way to add an item to the standard ContextMenu and failed. From my point of view, the only solution is to set the TextBox's ContextMenuStrip property to an instance of the ContextMenuStrip class and implement both standard and your custom menu items. It is easy to mimic standard operation, since the TextBox class provides all required methods: Cut, Copy, Paste, SelectAll.
The universal way is basically writing a "custom shell extension".
There is an article on CodeProject about how to do this.
http://www.codeproject.com/Articles/174369/How-to-Write-Windows-Shell-Extension-with-NET-Lang
The other way to do this is to build this into your application. For example you might have a text editor and you'll want to highlight a word and get a definition for that word. To do this you'll need to implement a context menu.
The VERY BASIC concept is detailed over on CodeReview.StackExchange.
https://codereview.stackexchange.com/questions/3983/c-programatically-creating-context-menu

Simpler Breadcrumb Bar Sample

my question is very simple. I am building an app(WPF CSharp) and I need user to give me paths that my app is going to use. Previously I added textboxes to show pathways, however, later I decided that it would be cool to use a Win 7 style Explorer navigation bar, which is a Breadcrumb bar. I found a great open source component for it here (http://www.codeproject.com/KB/tree/WPFBreadcrumbBar.aspx) however, I could not use it in my app. I added references both to Toolbox section and Project>References section. I can also add the control to my WPF window from Toolbox, yet I could not figure out how to fill it, how to change and show items in it etc. With respect to component author, I think article on Codeproject is not very 'understandable'(XAML? I want C# code please) and also PopulateItems event, for instance, did not work for me. So, if someone give me a basic example on how to add items to this bar easily, change items, or shortly, shows me how to make it work, I will appreciate for that,
Thanks.
I Guess it depends on how you want to present it. If you want to use a tab control to simulate the functionality you could go this route:
http://www.wpfblogger.com/post/BreadCrumb-TabControl-Style-for-WPF-40.aspx

How to setup feedback link on Windows Forms caption using C#?

I would like to setup Feedback link on every windows form, so that user can send suggestion about design, functionality etc.. using C# (.NET 3.5) but I could not find solution.
Any help or suggestion will be appreciated.
On every form? You could create a "FeedbackLink" UserControl, and place that whereever you like. I wouldn't recommend trying to do it as a clever blanket-thing, because you can never assume the place you want the feedback hyperlink won't be used by something else.
My suggestion would actually be to add it to the "Help" menu on your main form, and possibly in some kind of (very intrusive) pop-up dialog. Maybe do it the way Visual Studio tackles it - by putting an icon in the systray with a bubble that pops up for the user to click on?
Example image (might take a second or two to appear):
Example http://www.freeimagehosting.net/uploads/b7939d58ae.png

Replacement for yes/no/cancel MessageBox (C#)

I am looking for a decent replacement for the standard windows YES/NO or YES/NO/CANCEL MessageBox.
I have often seen these standard dialogs misused in ways such as: "To save in plain text answer YES, or to save in html answer NO". Obviously, the text should read "Save As: and the "buttons should be labeled "Text" and "HTML". It is not a yes/no question that is being asked, and although it could be phrased that way, it would not be easy to read and understand.
Microsoft gives no way to change the text on the buttons. There is no fast/simple way to build a replacement from scratch... as evidenced by the number of applications using the awkward style mentioned above.
Is there any free C# replacement dialog or MessageBox out there that lets you at least:
- specify the number of buttons
- specify the text to appear on each button
- specify the default button
I have looked and have been unable to find one.
(I would build one myself, but I am not familiar enough with all the behaviors that a fully functional control should have, since I only need/use/know a small subset. Two examples I don't use: themes and internationalization. I need something that my coworkers will also want to use.)
Check out Dissecting the MessageBox on CodeProject. The project is a bit dated, but it's pretty much exactly what you're looking for and it shouldn't take much to update it.
Depending on your target platform, a task dialog may be a good way of doing this. There is a .NET wrapper for task dialogs in the Windows API Code Pack. However these are provided only in Windows Vista and above, not in XP or 2003.
Frankly, it is not that difficult to create such a Messagebox yourself, we have such a thing working in the current app we are developing.
What you need is a FlowLayout for the buttons that will auto-align any buttons you create. Our API then has something like (params Tuple<string,DialogResult>[] buttons)
Tuple is a helper class that contains two values. The string is the Text of the button, the Dialogresult is the one our messagebox returns when the button with said text is clicked.
I agree with Frank. It wouldn't be too difficult to create your own generic form that handles this for you. Without getting into code, the form should do the following
1) Have a property to set the message you want to show to the user.
2) Have a method for adding buttons, with 2 arguments, one for the button text, and one for the dialog result
3) When the form is displayed, it should be in modal dialog mode so that the rest of the application is inactive while until one of the options is clicked.
So, to create a Save As/Don't Save/Cancel, you would add 3 buttons in step 2, all with the appropriate button text and dialog result.
Using Flow layout, you should be able to get it to display properly regardless of the size of the message, or the number of buttons.

Categories