Does `Property` path syntax supports casting in Avalonia, like in WPF?
Often in WPF we need to cast property to specific type to be able to access further properties in the path, e.g. from some...
View ArticleScrollIntoView and ListView with virtualization
I have ListView (virtualization is on by default), which ItemsSource is bound to ObservableCollection<Item> property.When data are populated (property is set and notification is rised) I see 2...
View ArticleAnswer by Sinatr for How to queue WhenAnyValue subscriber calls containing...
Using this answer I've made my own SybscribeAsync extension method with parameter:public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> func) =>...
View ArticleHow to queue WhenAnyValue subscriber calls containing asynchronous code?
What is the correct way to prevent subscribers to be called in parallel, before previous call is completed?I have kind of race condition atm with code like thisSomeReactive.WhenAnyValue(o =>...
View ArticleHow to avoid stale values when using WhenAnyValue and null propagation?
I need to monitor for changes of nullable Foo, including Foo = null or changes of any property like Foo.Bar = 123.So I am using this syntax (similar to recommended):WhenAnyValue(o => o.Foo, o =>...
View ArticleApplication.Startup event limitations (bug?)
It says, I can use Startup event for many things, like initialization, creating multiple forms, blablabla.However, try to create a new WPF application and add this event handler: private void...
View ArticleAnswer by Sinatr for How to serialize properties into separate Json using...
You can use json converters to customize produced json and perform custom steps (creating separate json-files in your case).Just to get you started, here is a converter:public class XConverter :...
View ArticleComment by Sinatr on Is it possible to deconstruct safely, e.g. with named...
I often refactor methods arguments, so I may do similar to what method returns. Also deconstructing of records doesn't have much support from intellisense, the method help just shows Bla and not Bla(a,...
View ArticleComment by Sinatr on Function definition with prototype vs without prototype
Related topic, but I can't dig the clear answer to my question out of it.
View ArticleAnswer by Sinatr for Binding DataGridCell content to Textbox in Customized...
You need to do something like this:<Style TargetType="DataGridCell"><Setter Property="ToolTip"><Setter.Value><ToolTip><TextBox Text="{Binding PlacementTarget.DataContext,...
View ArticleAnswer by Sinatr for How to run TextTransform.exe from VS 2015 on PC without...
There is a new official toolTextTransformCore.exe (all arguments are the same as TextTransform.exe), which is much easier to copy (all required files are there) and use (just copy required files and...
View ArticleComment by Sinatr on c# winformchart symmetric majorgrid
Please refer to minimal reproducible example, you have to show your exact case. I was hoping the provided help would be enough for you to continue on your own.
View ArticleComment by Sinatr on WPF ComboBox Display list of selected values
@IvanSerdukov, didn't noticed that issues. Try the fix.
View ArticleAnswer by Sinatr for How to disable TAB key in ContextMenuStrip?
To disable Tab-key in menus you need to handle PreviewKeyDown and set e.IsInputKey, this seems to prevent selection logic from running.There is a problem with sub-menus, because each drop-down has its...
View ArticleComment by Sinatr on How to discard property being written from json converter?
@Cleptus, what is your idea? Which attribute and where to apply?
View ArticleComment by Sinatr on Set size of WPF dialog in Loaded causes flickering and...
Initialized event - too early, Loaded - too late. In between there is a SourceInitialized event. Try it. Use mine approach to measure container, rather than going yourself through its children.
View ArticleAnswer by Sinatr for How to change visibility for some TreeDataGrid rows?
You will not be able to set TreeDataGridRow.IsVisible from Selector, because (as of now) it is set to true with LocalValuepriority. In the future pay attention to "Priority" column in Avalonia...
View ArticleAnswer by Sinatr for Is there a simple way to describe a list of equal...
How about using attached properties and syntax like this:<!-- Define xmlns:b="clr-namespace:Behaviors" --><!-- Create 5 columns: 1/3 width, 2/3 width, auto, auto and 50 pixels --><Grid...
View ArticleAnswer by Sinatr for How to lazily evaluate C# anonymous class property
Rather than storing result as object, why not storing lambda, which retreives it?Changevar obj = new { Number = GetNum() };DoSomeWork();Serialize(obj);tovar lazy = () => new { Number = GetNum() };...
View ArticleAnswer by Sinatr for Trying to get the number of weeks as displayed in a...
You are missusing GetWeekOfYear parameters, the last one should be same value for both calls, e.g. DayOfWeek.Monday.The correct value of firstWeek is 22, not 23 (fiddle).
View ArticleAnswer by Sinatr for Images Layout in FlowDocument
You need to put multiple images into same BlockUIContainer, using WrapPanel as its child.Here is xaml to demonstrate, converting it to code-behind should be fairly straightforward, you will need to...
View ArticleComment by Sinatr on JsonConvert.DeserializeObject always returns T, how to...
@Fildor, maybe? I don't have schemas and generating one with JSchemaGenerator looks like unnecessary step to me.
View ArticleComment by Sinatr on JsonConvert.DeserializeObject always returns T, how to...
Naive way of thinking: - (me) hey, library, parse for me this string as T please. - (library) Sure. - (me) But there is nothing of T in this json? - (library) not my problem, you got you T, be happy.
View ArticleComment by Sinatr on Update static property list
Yeah, maybe. I use this approach in scenario with auto-properies, but can't remember if changing e.g. List<string> in getter-only property and rising notification for it would fail. I would say...
View ArticleAnswer by Sinatr for XMLWriterTraceListener produces wall-of-text instead of...
Postprocessing is one possibility.You need to close listeners with Trace.Close(), then read/format/write "Trace.xml" file.The method could looks like this (credits to this answer, but you can take...
View ArticleAnswer by Sinatr for How to fix headers both left and top in a grid with...
To get you started, I've played a bit with my idea and it worked, but I made it only for horizontal ScrollBar.You need 3 ScrollViewer (for left/top headers and content) and 2 ScrollBar. I simulate...
View ArticleAnswer by Sinatr for How do I make a smooth transition in the slider switch?
I am not sure if using multiple storyboards with FillBehavior=Stop nor the layout is the best, but anyway to fix your code, you may need to cancel other storyboard.Give names to storyboards and use...
View ArticleOnly one byte is read when reading just now opened SerialPort
Strange issue.When I read from com-port with SerialPort.Read(), then if data arrive, only one byte is read on the first call, disregards of count parameter and number of bytes available within timeout....
View ArticleComment by Sinatr on How do I switch Keyboard Focus between the Main- and a...
Then there is a work left to do. Start here.
View ArticleComment by Sinatr on How do I make a button switch to display two?
It looks like you don't have second monitor available. Check this by logging Display.displays.Length in Start. Why you don't have second monitor? No idea, but here is a hint, that your game needs to...
View ArticleComment by Sinatr on How to fix poor C# pattern formatting e.g. using...
How about expression-bodies methods ? fiddle. I dislike original snippet formatting tbh.
View ArticleComment by Sinatr on System.Text.Json.JsonSerializer.Deserialize is not...
Use records, see fiddle.
View ArticleComment by Sinatr on Automatic property dependent on other properties
Does AA property really needs to belong to the same class? Why not having separate class, taking an instance of A and being responsible for constructing (factory?) of new AA if either/specific property...
View ArticleComment by Sinatr on Image flashes when maximizing Avalonia window
What is the expected behavior? If i open any jpg-file with Photos (windows 11 app) it flickers even more during switching between normal/maximized window. I only notice flickering after you told me....
View ArticleComment by Sinatr on OrderBy with string in LINQ .NET,
What is orderBy? A property name passed as string?
View ArticleComment by Sinatr on Is this usage of InotifyPropertyChanged and effective way?
Please go to codereview, make sure question is on-topic there. The reflection approach is obviously slow (bad), there are better ways, see ReactiveUI, MVVM Toolkit, source generators (here is...
View ArticleComment by Sinatr on Parsing .ini file using Linq
Maybe linking will help? Related, related.
View ArticleComment by Sinatr on How can i make MAUI Editor that expands its height based...
Please post minimal reproducible example. I tried adding Editor to my view and with AutoSize="TextChanges" and VerticalOptions="Start" it start small (one line), but expands without problem as I type...
View ArticleComment by Sinatr on WPF and MVVM Page Navigation
Is it a working code, which you want to improve? Consider doing code review.
View ArticleWhy the subscriber of WhenAnyValue is not triggered on property changes after...
I have MAUI application with ReactiveUI.MAUI and ReactiveUI.SourceGenerators packages.Here is view model:public partial class VM: ReactiveObject{ [Reactive] public partial string? Property { get; set;...
View Article