by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:27
    jtbrower opened #4739
  • Sep 24 18:16
    derekantrican edited #4738
  • Sep 24 17:53
    MarchingCube synchronize #4635
  • Sep 24 17:44
    MarchingCube commented #4731
  • Sep 24 17:40
    MarchingCube commented #4733
  • Sep 24 17:16
    derekantrican edited #4738
  • Sep 24 17:16
    derekantrican edited #4738
  • Sep 24 17:13
    derekantrican opened #4738
  • Sep 24 16:46
    workgroupengineering commented #4737
  • Sep 24 16:45
    workgroupengineering commented #4737
  • Sep 24 16:38
    workgroupengineering opened #4737
  • Sep 24 16:11
    workgroupengineering commented #4735
  • Sep 24 15:36
    sn4k3 opened #4736
  • Sep 24 14:56
    grokys commented #3395
  • Sep 24 14:51
    grokys commented #3395
  • Sep 24 14:48
    sn4k3 edited #4735
  • Sep 24 14:46
    sn4k3 edited #4735
  • Sep 24 14:46
    sn4k3 edited #4735
  • Sep 24 14:45
    sn4k3 edited #4735
  • Sep 24 14:42
    sn4k3 opened #4735
lorean-devries
@lorean-devries
cool thanks
ahopper
@ahopper
I've just been updating some code to use Image rather than DrawingPresenter, with vector icons it becomes a bit verbose, I wonder if icon packs should generate DrawingImages rather than Drawings
<!-- DrawingImage stored in resource -->
<Image Source="{DynamicResource VSImageLib.Settings2}" />
<!-- GeometryDrawing stored in resource -->
<Image>
  <Image.Source>
    <DrawingImage Drawing="{DynamicResource VSImageLib.Settings}"/> 
  </Image.Source>
</Image>

<DrawingPresenter Drawing="{DynamicResource VSImageLib.Settings}" />
this would mean you can swap between drawings, bitmaps and svg just by changing the resource
Steven Kirk
@grokys
maybe we could have a typeconverter to convert Drawing into DrawingImage automatically?
or would that be confusing?
Benedikt Stebner
@Gillibald
I don't think this will be still an issue when svg is supported.
Benedikt Stebner
@Gillibald
Also reusing the same drawing everywhere potatially break the moment you animate things.
Jose C Gomez
@josegomez
is there a way to set / force focus on a particular control ?
danwalmsley
@danwalmsley
control.Focus()
if you are in your viewmodel world, you will want to implement a behavior probably like:
Jose C Gomez
@josegomez
lol kinda obvious sorry @danwalmsley for the silly question (poorly worded rather) i am in a ViewModel and replacing the DataContext
Jose C Gomez
@josegomez
when the dataContext is a specific Model I want to focus on a specific control
this behavior works when it is the only control on the screen that you want to focus
and it will focus it when its displayed
or maybe your scenario is more complex?
Jose C Gomez
@josegomez
image.png
Actually I think its fairly similar
is just a single textbox on there and I want to be focused on the password box
thank you!
danwalmsley
@danwalmsley
you will need a couple of nuget packages, at some point in the future these will probably come with Avalonia
Jose C Gomez
@josegomez
works great !! thanks so much @danwalmsley
danwalmsley
@danwalmsley
no problem, remember anytime your tempted to write code behind (.xaml.cs) to directly manipulate a control like that, just create a behavior, that way you maintain MVVM pattern, you wont run into issues later either or make your app difficult to maintain.
Jose C Gomez
@josegomez
yeah that makes a lot of sense
I was heading down the OnAttached Event, search controls, set Control.Focus() path
thank you for straightening me out
danwalmsley
@danwalmsley
behaviors are reusable, so you wont have to re-write that code over and over on every view
Jose C Gomez
@josegomez
btw is there an Avalonia built in / Sanctioned way of parsing / reading from command line params?
danwalmsley
@danwalmsley
no, but there are several nuget packages that can do that for you I beleive
Jose C Gomez
@josegomez
I ended up using Environment.CommandLine
just didn't know if there was a way to pass args[] directly into App.cs
danwalmsley
@danwalmsley
well you can pass args[] to your App class, or Viewmodel
Jose C Gomez
@josegomez
fair enough works fine just wanted to make sure I wasn't hacking my away around stuff
danwalmsley
@danwalmsley
prob Environment.CommandLine is good
Jose C Gomez
@josegomez
yeah thanks I tested it in Nix too and works. BTW WSL is working great too now so thank you again for that
I get about 2 billion angry looking warnings on console
but it works
danwalmsley
@danwalmsley
haha
Jose C Gomez
@josegomez
ok things are getting a bit hairy now LoL not even sure if this is an Avalonia specific question but throwing it out there. I have a thread that does some IPC (inter process communication) I need to from that thread to get a hold of the Window and set its focus.
var x = AvaloniaLocator.Current.GetService<MainWindow>();
I can do that and I get the Window, but when I try to set focus I get a cross thread operation error... normally this is resolved by using x.Invoke() but Window doesn't have Invoke as an option
any ideas?
Dariusz KomosiƄski
@MarchingCube
Dispatcher.UIThread.Post is the equivalent
same story as in WPF
Jose C Gomez
@josegomez
amazing! thank you
ahopper
@ahopper
@grokys @Gillibald Just pondering the options, svg sources will be just as verbose unless there is some type converter or they are also stored as svgimagesource resources in a resource. There are many uses where the same icon is shown repeatedly (eg a file browser) so it would be good to identify a lightweight best practice. Animation is interesting, I have always treated Drawings as effectively frozen and shareable, is there an example of an unshareable animated drawing?
Benedikt Stebner
@Gillibald
Currently Drawing isn't animatable but it should be. For loading svg assets you would just supply a uri source that is automatically converting to IImage.
ahopper
@ahopper
there is an argument for keeping Drawing non animateable for this very reason, wpf has two classes of geometry for this reason. I bet there will be people who want animateable svg :)
Chris
@Rfvgyhn
when writing unit tests for a class inAvalonia.Controls.DataGrid, should they be in a new project called Avalonia.Controls.DataGrid.UnitTests or should they go in the existing Avalonia.Controls.UnitTests project? If the former, should Avalonia.Controls.DataGrid.AssemblyInfo not expose internals to Avalonia.Controls.UnitTests?[assembly: InternalsVisibleTo("Avalonia.Controls.UnitTests")]
any suggestions?