dynamic string localization in WPF - c#

I have a C#/WPF application and I am attempting to add multi-language support. From my looking around I've found that using resource files of string values for each language is how I should go about doing this. Then update the CultureInfo. This seems to work fine if the culture info is set at or before the creation of the window, but I want the ability to dynamically change the culture. How can I do this? I've tried playing around with binding and dynamicResource, but couldn't figure out how to get either one to work. I guess I should add that I'm pretty much a beginner with the WPF stuff.

Take a look at this Codeplex project. It provides a dynamic localization system that blends well with WPF's binding system.

Related

WPF- How to Make Menu control look native

I am currently learning WPF framework; I have some past (not much though) experience with Winforms. One problem I've had in both is that the menubar does not look native. I've found a workaround in Winforms, but I haven't been able to find anything for WPF. I've not had this problem in other frameworks I've used, particularly Qt.
In many pics I've seen, it looks native enough in Windows 7, but not Windows 10. I included some pics.
How it currently looks:
How it should look:
Thanks in advance!
Edit
While I have not seen the possible duplicate link, I am aware of setting the foreground/background on WPF controls. That link doesn't really answer my question. I don't want to come up with my own style at this point; all I want to do is make controls look native.
If custom styling is the only way, that's fine, but if there is another way, that would be preferable.
Thanks!
I don't think there's a quick fix to get what you want. WPF renders using DirectX, allowing for much more flexibility in styling applications. A WPF app should render exactly the same way on any version of Windows - it will not automatically adopt a native look and feel (that was actually one of the main selling points of the technology in its early days).
While MS made the default styling somewhat close to Windows at the time of release (Vista, I think?), if you want WPF controls to have a particular look you're going to have to style them yourself.

Pull to Refresh UWP - Grid view?

Could someone please advise me on the "correct" way of implementing Pull to refresh on UWP?
Below are some examples I've found however I'm not sure which one is using the best approach:
Microsoft sample which is for a ListView - This works however it is specific to the ListView Control
AmazingPullToRefresh is a NuGet package that also works however it is somewhat limited in terms of styling
PullToRefreshUWP_WindowsComposition is another example however it works differently to the other two as it does not use an extension class
Any advice is much appreciated
There is no standard answer for this question, basically, there are two points we need to implement:
Get the offset changes when user pull something on the control
Generate some indicator to notify user
Both XamlPullToRefresh and PullToRefreshUWP_WindowsComposition use the new Windows Composition API: Windows.UI.Composition namespace
Ref Windows.UI.Composition Overview
The API is a powerful supplement to existing frameworks such as XAML
to give developers of UWP applications a familiar C# surface to add to
their application. These APIs can also be used to create DX style
framework-less applications.
Please notice that this API works only on Windows 10.
While AmazingPullToRefresh uses Manipulation API and implement all things by calculating offset changes. A similar implementation can be found here
If you want to implement a cool pull-to-refresh control, I would recommend using the Windows.UI.Composition API. You can get start from here
The functionality of pulling to refresh is not used by microsoft.
Reloading a page / data is something we have still in our mind from thinking apps like a website.
Why not have a synced database and alway update your UI with the data which got changed in your local db? For eg. see firebase.google.com
If you want to implement this feature anyway there is not really a way to go.
I have used the PullToRefresh.UWP library from NuGet. For a tutorial see:
codeproject.com
With some tweaking it works but sometimes when I lift my finger of the screen after pulling down the bar won't go up again.
So the answer is: Sorry, but nobody can give you an answer on how to do this the "correct" way. But is there a correct way anywhere? Like almost always in programming. It depends on the case you will use it.
Hope this will help you.

Best way to implement a multilingual application in silverlight and WPF

I have always been interested in how should I implement a multilingual applications and what or which way I should go to deal with this and also what's the best way to control the layouts in application scope? I've read many articles but the more read, the more confused I get. I want to know Is there any standard pattern to implement application such as this.
Any advice will be helpful.
I have found Location using MarkupExtension the best way to do localization in WPF and I also have successfully used it in one of my WPF projects.
It allows you to change the language of whole application at run-time. You can allow user to select and change language at run-time without requiring user to restart the app.
I'm currently developing a multilingual application, these links helped me a lot:
WPF Globalization and Localization Overview
WPF Localization Guidance
IMO working with BAML is very painful instead I'm using WPF localization extension now, It's very good library and very easy to use.

What are some of the more utilized WPF (optionally, including Silverlight) .NET forum/discussion sites?

Just looking for a list of some popular WPF/Silverlight/C# sites out there for problems/troubleshooting that may need a little more back-and-forth to resolve than stackoverflow's format offers. (This is the issue that I think I should have dropped into an active "traditional" forum instead, in case anyone is able to assist: How are WPF Buttons and TextBlock styles related? , thanks.)
http://windowsclient.net/Forums/
http://social.msdn.microsoft.com/forums/en-US/wpf/threads/
http://forums.silverlight.net/

Are Visio-Like WPF GUI's possible?

I want to create buttons and displays in WPF that look something like the Visio Flow Chart displays. Are there classes for that?
Here's a series of articles which show you how to create a drag'n'drop flow chart designer in WPF:
http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part4.aspx
The problem with that particular implementation (WPF Diagram Designer on Code Project) is that it is not MVVM based and generally doesn't use an architecture that is flexible or extensible to further development (e.g. just wanting to add Undo/Redo support would argue for a rewrite). It does, however, include a path finding algorithm (though in production use I fear it may be a little buggy).
I would recommend looking at the WpfDesigner.* assemblies in the SharpDevelop project (it's open source) and the WPF DrawTools on Code Project (http://www.codeproject.com/Articles/22776/WPF-DrawTools). The architectures of both of these are at least somewhat amenable to further development. Just ensure the licensing is compatible with your use, particularly for SharpDevelop.
I found http://www.codeproject.com/Articles/182683/NetworkView-A-WPF-custom-control-for-visualizing-a quite good. You would need to extend it with some UI templates to get the shapes you want and perhaps change the connector attachment scheme to fixed locations.

Categories

Resources