- .NET
- .NET Core 1.1
- 3D
- Android
- Angular
- Angular2
- AngularJS
- apps
- Architecture
- array
- ASP .NET
- async
- await
- Azure
- binding
- C#
- changes
- closure
- cocoa
- code
- collection
- components
- composition
- cross-platform
- delegate
- dependency injection
- design
- desktop
- Development
- escaping
- events
- exception
- for
- generalization
- git
- Holographic
- HoloLens
- HTML
- iCloud
- INotifyPropertyChanged
- iOS
- iPhone
- JavaScript
- learn
- learning
- Mac
- macOS
- Mobile
- mocking
- multi-threading
- MVC
- PC
- properties
- quality
- SQL Server
- Surface
- Swift
- target
- technologies
- technology
- testing
- tools
- types
- TypeScript
- unit tests
- Unity
- UWP
- Visual Studio
- WebAPI
- Windows
- Windows 8
- Windows 10
- Windows Phone
- WPF
- xCode
Archives
Top 10
- Want to learn WPF? Get a book
- How to write good code on first attempt
- Don't set NSPopupButton's menu.items!
- Books do make a difference
- Developing HTML UI for SQL Server data with no middle code (or just a few lines)
- XAML element properties and cut-paste refactoring
- macOS milestone
- How to improve your good code further
- Embedding custom Cocoa macOS views with xibs into frameworks
- Generically handling multi-threading exceptions in WPF
- Follow Code {Sections} on WordPress.com
Category Archives: .NET
access_token unavailable?
This call returns null for you (so your app cannot use Microsoft Graph APIs)? await HttpContext.GetTokenAsync(“access_token”); … and you’ve tried already most of the things found on StackOverflow? options.ResponseType = OpenIdConnectResponseType.IdTokenToken; options.SaveTokens = true; Maybe you’ve just missed to check … Continue reading
SHA*Managed + FIPS = hate š
If you write .NET software that cryptographically validates signatures, e.g. you verify a customer’s license at runtime, be aware of issues when the check runs on US government-certifiedĀ FIPS-enabled computers. Chances are that you run Sha256Managed algorithm for computing a hash … Continue reading
Indexing for IndexOf
Today, a short one. But it gave me some not-so-short trouble recently. Do you happen to use or inherit Collection or any of its subclasses (e.g. ObservableCollection)? Make sure you don’t call its IndexOf method too much. As indicated on … Continue reading
Hacking the WPF DataGrid: properly hiding rows for unwanted items
If you even need to hide some DataGridRow elements displayed in a WPF DataGrid please remember these few things – it took me some time to realize and solve them all: If you plan to just set DataGridRow.Visibility to Collapsed … Continue reading
Posted in WPF
Tagged binding, Collapsed, CollectionView, DataGridRow, ItemsSource, Visibility
Leave a comment
Generically handling multi-threading exceptions in WPF
You have a WPF app and you just want to show a message whenever an exception is raised an not handled anywhere else in code. The first try is surely this: This works fine, as long as the exception isn’t … Continue reading
Moq: how to VerifySet with an object that respects a condition
Sometimes you want to test that a service method sets up the correct object on another (singleton) service.Ā For example, that an authentication service sets up a user object with the correct username to the app’s user context. With Moq you … Continue reading
ToolTipService.ShowDuration within a specific WPF view
ToolTipService.ShowDuration attached property isn’t inherited from parent to child elements within the WPF visual tree, and therefore values for this property – to produce runtime effects – must be set on all the elements that have ToolTips for which we’d … Continue reading
Posted in WPF
Tagged ShowDuration, ToolTip, ToolTipService, WPF
Comments Off on ToolTipService.ShowDuration within a specific WPF view
Mocking “this”
Let’s assume we have a simple service that is also using an inner service, providing a few operations as follows: publicĀ interfaceĀ IService { Ā Ā Ā Ā stringĀ A(); Ā Ā Ā Ā stringĀ B(); Ā Ā Ā Ā stringĀ C(); } publicĀ classĀ ServiceĀ :Ā IService { Ā Ā Ā Ā privateĀ readonlyĀ IInnerServiceĀ innerService; Ā Ā Ā Ā publicĀ Service(IInnerServiceĀ innerService) Ā Ā Ā Ā { Ā Ā Ā Ā Ā Ā Ā Ā this.innerServiceĀ =Ā innerService; Ā Ā Ā Ā } Ā Ā Ā Ā publicĀ stringĀ A() Ā Ā Ā Ā { Ā Ā Ā Ā Ā Ā Ā Ā returnĀ “A”; Ā Ā Ā Ā } Ā Ā Ā Ā publicĀ stringĀ B() Ā Ā Ā Ā { Ā Ā Ā Ā Ā Ā Ā Ā returnĀ b(); … Continue reading
Invariant string interpolation
I’m sure you like C# string interpolation support ($”{…}”): var start = DateTime.Now; var end = start.AddDays(7); string weekIntervalText = $”{start}-{end}”; But you also know that this uses the current thread’s culture to format the string, so you think “Oh, … Continue reading
Attached properties and the WPF DataGrid
WPF attached properties. They look like such a difficult topic. But you only need to see a single example in action to understand their true potential: as long as your objects inherit from DependencyObject you can add as many extra … Continue reading