Guys, remember to set the Access Modifier to internal in the Resources file. I spent more than a hour trying to figure out why i couldn't reference the resource file 😑😑😑 . It worked thankss a lot
@BrianLagunas3 жыл бұрын
Great tip! Thanks for sharing
@shaihulud45154 жыл бұрын
I am a pure hobbyist, and I can't tell how often I thought "I just quit, this is way above my head". Your vids could be a bit longer, but you break down things in an entertaining and yet comprehensive way. Thanks for letting me find new joy in my hobby Brian!
@BrianLagunas4 жыл бұрын
Thank you for the kind words. You really made my day.
@Tamer_Ali4 жыл бұрын
Amazing video I hope you continue this video by telling us how to change the control/form direction when changing the culture. thanks
@BrianLagunas4 жыл бұрын
My next video will answer this question. I hope you like it.
@Tamer_Ali4 жыл бұрын
@@BrianLagunas cannot wait
@mahmoudalaskalany4 жыл бұрын
thanks man i just searched for this topic because i need it in a project and it was very helpful keep up the good work brian
@BrianLagunas4 жыл бұрын
Glad I could help!
@ovimine76282 жыл бұрын
Thank you for this helpful video :) Question: If I do _Array StatusList = Enum.GetValues(typeof(Status));_ from _App.xaml.cs_ _OnStartup(...)_ I'm not getting the localized enum descriptions, any idea how to get the enum localized description when called from a C# code?
@solvedplus8583 жыл бұрын
awesome , many thanks for your very valuable tutorial
@BrianLagunas3 жыл бұрын
Thanks for watching
@derschnurlich15124 жыл бұрын
Even after 15 years of C #, there is not a day where you don't learn something new. Thank you.
@BrianLagunas4 жыл бұрын
Me too! I am constantly learning something new everyday.
@gregersander96984 жыл бұрын
Thanks for your short videos. Right to the spot. I would like to know how to implement logging in a .net Core Prism best way. Should you use the ”built” in Microsoft dependency to implement? What’s the best way? Thanks
@BrianLagunas4 жыл бұрын
You can use any logger you want with Prism. It's rally a matter of preference. Just make sure you register the logging service with Prism, and you'll be good to go.
@AeromodeloRCBr4 жыл бұрын
Interesting .... Thanks for sharing. Very good would be the use and ENUM using SQL database
@BrianLagunas4 жыл бұрын
Thanks for watching
@longuinni4 жыл бұрын
That is nice!! Thanks for sharing Brian
@BrianLagunas4 жыл бұрын
Thanks for watching
@VinuP20234 жыл бұрын
Thank you Brian 😊 Tech question: When do we use dispose and finalize methods?
@BrianLagunas4 жыл бұрын
Thanks for watching
@MikeOShay Жыл бұрын
I've been looking for the most efficient ways to do localization, and this is pretty promising! Any ideas if it could be simplified to avoid re-typing the name of each enum in each attribute? If the keys in the resx files correspond to the keys in the enum, it would be a lot more convenient to just get the name of the enum so we only have to type "[LocalizedDescription(typeof(EnumResources)]" for every entry, but maybe that isn't something the attribute is able to access.
@metaverse1004 жыл бұрын
Hi Brian, could you show us how to show version of program in dotnet core? In the old dotnet you could set automatic version number in assemblyinfo.cs with [assembly: AssemblyVersion("1.0.*")] but it is not available in dotnet core?
@BrianLagunas4 жыл бұрын
I could probably come up with something on versioning.
@ievheniiierokhin16774 жыл бұрын
Awesome, thank you very much!!!
@BrianLagunas4 жыл бұрын
Glad it helped!
@gajarubanjeyakumar72264 жыл бұрын
@Brian Lagunas I wonder if you could do a video on expression trees? Dynamically subscribing to events using lambda expressions. I'm developing a scada application in wpf, i plan to develop some coustom controls like analog gauges. They need to subscribe to events (tag Value changed) They know the event name as a string only, which is a dependency property.
@BrianLagunas4 жыл бұрын
That's a pretty advanced topic, and one I haven't touched in awhile. You can see the code that Prism uses to automatically subscribe to events using expression trees here: github.com/PrismLibrary/Prism/blob/master/src/Prism.Core/Commands/PropertyObserver.cs
@gajarubanjeyakumar72264 жыл бұрын
@@BrianLagunas thanks, i will have a look. Maybe you can do it on your stream? :) I wish.....
@alexinaorsoni62514 жыл бұрын
Thank you Brian for this video. Something wired (or not, perhaps you could help me) : I followed your course and it doesn't work in my project. Description (localized or not) doesn't appear in my combobox but I have the name of enum. Besides, I used a binding for the selectedItem : to have the text of my selected item I have to use the type of my enum and not a string. Do you have an idea to use your tips in my case ? Thanks
@BrianLagunas4 жыл бұрын
Hard to say without seeing the code.
@nandkishorsonwale4 жыл бұрын
Thanks for amazing video.
@BrianLagunas4 жыл бұрын
Thank you for watching
@Tamer_Ali4 жыл бұрын
Brian, could you add your other social media links to your KZbin channel's ABOUT tab like Twitch if you don't mind? I'd like to watch your awesome videos and streams and learn more from you.
@BrianLagunas4 жыл бұрын
Thanks for the tip. I added some more links
@Tamer_Ali4 жыл бұрын
@@BrianLagunas great 👍
@SkaptorOriginal4 жыл бұрын
Hey Brian! what about the selectedItem/selectedValue binding? can it be done as well?
@BrianLagunas4 жыл бұрын
Yes you can localize the SelectedItem of the combo as well. Most likely you'll just need a converter that reads the description attribute to get the localized text.
@mywildlifestories37934 жыл бұрын
Hey Brian, is there any significant difference in usage of ivalueconverter and markupextension. Could you please elaborate more on these with example. When to use which?
@BrianLagunas4 жыл бұрын
There's a big difference between the two. Are you asking specifically around the custom markup extension to bind to the enum?
@mywildlifestories37934 жыл бұрын
@@BrianLagunas enums Or any other objects
@fredyjimenez48534 жыл бұрын
Amazing video, thankss
@BrianLagunas4 жыл бұрын
Thank you
@zerologics51054 жыл бұрын
Thanks Brian!! Can you please make a video on how to make a multiple selection ComboBox?
@BrianLagunas4 жыл бұрын
Hmmm... I'll have to think about the best way to keep something like that simple enough to do a video.
@omarbousbia69164 жыл бұрын
Thanks Brian, nice video. but i would like to ask more questions about binding to enums: how to bind a set of radio buttons/ checkboxes to an enum ???
@BrianLagunas4 жыл бұрын
There are a lot of ways to do this. I'll see if i can come up with an easy one that makes sense for a video.
@omarbousbia69164 жыл бұрын
@@BrianLagunas 👌
@harsheng4 жыл бұрын
You are great👍
@BrianLagunas4 жыл бұрын
Thank you so much
@knowfaster4 жыл бұрын
How to communicate between ViewModels that opened in multi instance in MVVM
@BrianLagunas4 жыл бұрын
You just want to send messages between different viewmodels?
@knowfaster4 жыл бұрын
@@BrianLagunas yes, but to specific instance
@emilsandgren52904 жыл бұрын
Thank you for the video A question regarding using this in library code. Is there any other simpler way to use this converter than to write this: var statusValue = Status.Good; var statusDescription = new EnumDescriptionTypeConverter(typeof(Status)).ConvertTo(statusValue, typeof(string)).ToString();
@BrianLagunas4 жыл бұрын
I believe you can just do `new EnumDescriptionTypeConverter(typeof(Status)).ConvertToString(statusValue);`
@BrianLagunas4 жыл бұрын
Actually, I would just create an extension method to make it a single line of code public static string GetDescription(this Enum @enum) { return new EnumDescriptionTypeConverter(@enum.GetType()).ConvertToString(@enum); } Then all yo have to do is: var statusDescription = statusValue.GetDescription();
@MrTellus4 жыл бұрын
Nice. But your last comment made me lol - That's how EASY it is to localize your enums
@BrianLagunas4 жыл бұрын
Well, it's easy now that you know how to do it 😁
@MrTellus4 жыл бұрын
@@BrianLagunas Sure 😉 For me the reflection part is the hardest to get right when coding.
@stasostrin474 жыл бұрын
Big thanks! )
@BrianLagunas4 жыл бұрын
Thanks for watching
@yevheniytymchishin84014 жыл бұрын
Ok, what if I have my localization service in the IoC container? Probably I am not able to use that in the attribute.
@BrianLagunas4 жыл бұрын
Sure you can. You just need to use a pattern like service locator so you can access the service in the attribute.
@yevheniytymchishin84014 жыл бұрын
@@BrianLagunas Yeah, thanks. I guess I never used such approach yet.
@RebecaBagu-l2z11 ай бұрын
in 2024 still works :) Thankss a lot
@BrianLagunas11 ай бұрын
Awesome! Great to hear
@ShadowAimai2 жыл бұрын
Huh. I don't think I have ever thought of doing it this way. I usually have this kind of information in SQL, rather than it being hard coded.
@dksovfen4 жыл бұрын
Tech question: How can I generically do this: if (obj.GetType() == typeof(string)) { var result = SomeMethodReturningOrNeedsT(); }
@BrianLagunas4 жыл бұрын
Oh that's easy, not sure I should do a video, or just show you 😁
@dksovfen4 жыл бұрын
Brian Lagunas What ever floats your boat :) and thanks alot in advance
@BrianLagunas4 жыл бұрын
@@dksovfen Just use typeof(T) == typeof(string)
@dksovfen4 жыл бұрын
Brian Lagunas i mean the type is a variable but i need to parse it like this: method(); but that syntax doesnt work but how can i do this then without If and Else or switch alot of types. Also, im not in control of the method im just using it.
@BrianLagunas4 жыл бұрын
I'm sorry, but I don't have the full context of what you are trying to do. Generics only work with known types. That's why every generic method should have a non-generic. Are you trying to check what type a method argument is?
@Nerin18 Жыл бұрын
It would be nice if you share this project code. Despite your efforts, I failed to run this example.
@perahoky4 жыл бұрын
How to localize WPF keyboard keys (KeyDown, KeyEventArgs, System.Windows.Input.Keys etc) to apply as display value on KeyGesture, KeyBinding for a keyboard shortcut control. Isnt quite easy..
@BrianLagunas4 жыл бұрын
I'm not sure I understand the scenario exactly. You want to display a localized value for a key that has been pressed? Just get the localized value from the resource file using the key as the resource "name".
@jakubsuchybio4 жыл бұрын
Why reflection, when there is couple of non-reflection solutions. Whyyyyyyy
@BrianLagunas4 жыл бұрын
This is just I how solved the problem. Would you mind sharing your couple of non-reflection solutions that allows the use of a long description with localization support and the ability to specify the resource file? One that I have used in the past was a IValueConverter, but I really dislike that approach as it was too limiting for my needs and required more code on the XAML side to function, which means other devs on the teams needed to know the details to make it work. You'd also have to write code in the converter to convert the localized value back into an enum which I really disliked. Over the years, I have found my approach best for the production apps I write. This also works across multiple platforms and is not specific to WPF. Write once, use everywhere.
@mikoo19914 жыл бұрын
plz no more c#. we want videos about web dev as requested earlier!
@BrianLagunas4 жыл бұрын
I record videos based on the questions I get. I don't get many questions about web. Asking for web videos is too broad for anything actionable.