These are chat archives for AvaloniaUI/Avalonia

11th
Dec 2015
Nikita Tsukanov
@kekekeks
Dec 11 2015 00:00
Well, you need to implement drag support
Darnell Williams
@Seeker1437
Dec 11 2015 00:01
right
Nikita Tsukanov
@kekekeks
Dec 11 2015 00:02
We won't support that WM_NCLBUTTONDOWN hack
We also won't support any border styles other than "with/without border"
Since *nix systems don't have proper equialent for them
Darnell Williams
@Seeker1437
Dec 11 2015 00:04
hmmm

I have a couple questions for you then kinda off topic while I start working out more of the interaction:

        private WeakReference _previousSelection;

right now we do now really have an equivalent type of thing through WeakSubscriptionManager do we?

danwalmsley
@danwalmsley
Dec 11 2015 00:11
I think weak reference is portable?
Nikita Tsukanov
@kekekeks
Dec 11 2015 00:11
yep
it's in PCL7 profile after all
danwalmsley
@danwalmsley
Dec 11 2015 00:11
I don't think you have to change that
Darnell Williams
@Seeker1437
Dec 11 2015 00:13

okay cool and then the last question,

for events like when a tab selection changes, I would need to get the IObservable for that or are the controls just missing some events?

Darnell Williams
@Seeker1437
Dec 11 2015 00:28
grr right and we didn't like routedevents?
nvm I just left out the reference
Nikita Tsukanov
@kekekeks
Dec 11 2015 00:31
argh, window doesn't get redrawn properly for some reason
when decorations are disabled
wtf
Darnell Williams
@Seeker1437
Dec 11 2015 00:32
oooh so Perspex itself doesn't have the drag support
Nikita Tsukanov
@kekekeks
Dec 11 2015 00:40
AvalonDock uses WM_NCLBUTTONDOWN hack, you know
We don't have that on *nix
Oh, wait
Darnell Williams
@Seeker1437
Dec 11 2015 00:43
my control used WPF's system
so I am not sure what I can use as a replacement
I only basically saw VectorEventArgs, but I have a feeling that is not what we need
I will have to leave it out for now XD until I can figure out more of it
Darnell Williams
@Seeker1437
Dec 11 2015 00:57
so you kinda build the drag events into Thumb
so I really only Need VecterEventArgs right?
Nikita Tsukanov
@kekekeks
Dec 11 2015 01:12
@ImaBrokeDude here you go Perspex/Perspex@8f24ccf
I'm not sure that we should implement StartResizeDrag (built-in support in GTK, WM_NCLBUTTONDOWN hack for win32 )
@grokys need your opinion here
Darnell Williams
@Seeker1437
Dec 11 2015 01:16
nice!
And I'm not sure that we'll want to do that when we'll be implementing our native MacOS backend
Darnell Williams
@Seeker1437
Dec 11 2015 01:18
yeah it is going to be inportant that if dragdrop is available, it needs to be xplat I see what you mean, I wouldn't know how to make it core ready though
what I am doing is more that a library that would depend on that system already being there
Darnell Williams
@Seeker1437
Dec 11 2015 01:29
@kekekeks how about SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN
Nikita Tsukanov
@kekekeks
Dec 11 2015 01:40
what do you need them for?
Darnell Williams
@Seeker1437
Dec 11 2015 01:41
Drag drop support
... sorrDragDelta support
Nikita Tsukanov
@kekekeks
Dec 11 2015 01:43
Ehm?
Darnell Williams
@Seeker1437
Dec 11 2015 01:45
I don't know how to use our VectorEventArgs :( and you have them restricted to Thumb but someone should still beable to reference the event when handling it somewhere else
85 comments, lol
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:15
http://www.codeproject.com/Articles/17727/Unmanaged-Vista-Power I wonder if we can get alpha transparency for our windows
And still keep reasonable performance
Shouldn't be an issue with compositing WM, but still
It seems that for windows we'll need to manually draw decorations
argh
Darnell Williams
@Seeker1437
Dec 11 2015 02:19
ah which means it might not resemble the platfrom specific look?
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:20
no idea
There are some drawing apis for that
Well, let's leave this stuff for future
It's not supported on all systems anyway
Some linux WMs still don't use compositing for some weird reason
Darnell Williams
@Seeker1437
Dec 11 2015 02:21
Well, I know you are focused, any hints on where I could start in regards to being able to have drag su[ort XD
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:23
Well, if we implement StartMoveDrag, you'll get drag almost automagically
But I'm not sure that we should do that
Well, if GTK emulates that stuff, we also can do that
Emulation code is simple anyway
@grokys What's the main difference between Popup and Window?
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:28
I don't see why shouldn't we just merge them
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:44
@ImaBrokeDude Perspex/Perspex@0b08759
Steven Kirk
@grokys
Dec 11 2015 02:48
yeah, i guess they could be merged. the only difference is in the border, toplevel state
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:49
Well, I've added HasSystemDecorations to Window
Perspex/Perspex@8f24ccf
Steven Kirk
@grokys
Dec 11 2015 02:50
cool
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:50
So there is almost no difference
Darnell Williams
@Seeker1437
Dec 11 2015 02:51
thanks @kekekeks , will controls have drag detection (not just Thumb?)
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:51
I'll merge them when I'll get more free time
@ImaBrokeDude I thought we were talking about that docking stuff
which needs windows to be detached from main one
Darnell Williams
@Seeker1437
Dec 11 2015 02:52
right, however the big thing for this system is that it also allows controls to create new windows
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:52
Ehm, wat?
I'm not sure that you understand how drag in AvalonDock works
Darnell Williams
@Seeker1437
Dec 11 2015 02:53
Basically a TabItem would be inside a TabCOntrol, I would then be able to drag the TabItem out of the TabCOntrol (and out of the window) and my COntroller will then Create a new window, with a new TabControl and Dock the tab in it
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:54
I'm afraid that you'll need some custom tabcontrol to do that
Darnell Williams
@Seeker1437
Dec 11 2015 02:54
sorta like chrome tabs?
right that is in progress
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:54
I recommend you to read AvalonDock sources
Darnell Williams
@Seeker1437
Dec 11 2015 02:54
the only problem is I have no way to detect the drag events from the tabcontrol
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:54
you need to handle mousemove with left button pressed
no big deal
When it happens you need to create a new window (I recommend Popup since it has topmost flag), properly resize it, move where it's supposed to be and call BeginMoveDrag
BTW, in your case you need to detect the moment when drag is stopped
And you can't do that with BeginMoveDrag
And we currently don't have all needed APIs to do that manually
Darnell Williams
@Seeker1437
Dec 11 2015 02:58
DragCompletedEventArgs
yeah XD
Nikita Tsukanov
@kekekeks
Dec 11 2015 02:59
Nope, ain't gonna work
There is no event from system
That signals about the drag being completed
So it seems that you need to wait till the weekend
Darnell Williams
@Seeker1437
Dec 11 2015 03:10
sure thing
how hard would ti be to add a datatemplate selector?
danwalmsley
@danwalmsley
Dec 11 2015 09:17
@kekekeks many thanks for hassystemdecorations exactly what I need!!!
can implement a custom window now!!
legend!
danwalmsley
@danwalmsley
Dec 11 2015 10:06
guys iv tried to create a control called Metro Window
iv added a style with template...
and add the style
my control inherits window
but it doesnt seem to get overrided!!
MetroWindow.cs
namespace AvalonStudio.Controls
{
    using Perspex.Controls;    

    public class MetroWindow : Window
    {
        public MetroWindow()
        {
        }
    }
}
template / style
<Styles xmlns="https://github.com/perspex" xmlns:local="clr-namespace:AvalonStudio.Controls;assembly=AvalonStudio">
  <Style Selector="local|MetroWindow">
    <Setter Property="FontFamily" Value="Segoe UI"/>
    <Setter Property="FontSize" Value="12"/>
    <Setter Property="HasSystemDecorations" Value="false"/>
    <Setter Property="Template">      
      <ControlTemplate>
        <Border BorderThickness="12" BorderBrush="Red" Background="{TemplateBinding Background}">
          <AdornerDecorator>
            <ContentPresenter Name="PART_ContentPresenter" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
          </AdornerDecorator>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
</Styles>
theme
<Styles xmlns="https://github.com/perspex">
  <StyleInclude Source="resource://application/AvalonStudio/AvalonStudio.Controls.MetroWindow.paml"/>
</Styles>
app.cs
            Styles.Add(new MetroWindowTheme());
the template is not getting applied though
Window always gets styled as Window; otherwise everyone would need to specify a separate style for every class derived from Window!
danwalmsley
@danwalmsley
Dec 11 2015 10:46
ahhh!
anyway around this?
Steven Kirk
@grokys
Dec 11 2015 10:46
to change that, reimplement IStyleable.StyleKey on your window class to return MetroWindow
danwalmsley
@danwalmsley
Dec 11 2015 10:46
@grokys thanks mate
Steven Kirk
@grokys
Dec 11 2015 10:47
how hard would ti be to add a datatemplate selector?
you shouldn't need to as DataTemplates in Perspex are more powerful and have a Match method
danwalmsley
@danwalmsley
Dec 11 2015 10:49
    public class MetroWindow : Window, IStyleable
    {
        public MetroWindow()
        {
        }

        Type IStyleable.StyleKey => typeof(MetroWindow);
    }
}
like that?
awesome it works
Steven Kirk
@grokys
Dec 11 2015 10:51
yep, exactly
danwalmsley
@danwalmsley
Dec 11 2015 10:51
        <Border Background="{TemplateBinding Background}">          
          <AdornerDecorator>
            <ContentPresenter Name="PART_ContentPresenter" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
          </AdornerDecorator>          
        </Border>
trying to put a grid in above AdornerDecorator...
but AdornerDecorator doesnt seem to like Grid.Row=
Steven Kirk
@grokys
Dec 11 2015 10:52
not sure if i should change it back to work like WPF though, where you need to explicitly specify the style key for each class
danwalmsley
@danwalmsley
Dec 11 2015 10:52
oh im getting confused with designer showing errors on templates
hmm I like that you only change it if you need to
and most of the time it defaults...
would have been more discoverable if it was an override
I could have styped override and found StyleKey in intellisense!
Steven Kirk
@grokys
Dec 11 2015 10:53
yeah, that might be a good idea
Steven Kirk
@grokys
Dec 11 2015 11:05
ok, would anyone mind if i got rid of TabControl and made you put a TabStrip and a Carousel/ContentControl in XAML explicitly and bound their SelectedIndex properties?
only half joking
TabControl really messes up the logical tree
there's no other control like it
Wiesław Šoltés
@wieslawsoltes
Dec 11 2015 11:23

ok, would anyone mind if i got rid of TabControl and made you put a TabStrip and a Carousel/ContentControl in XAML explicitly and bound their SelectedIndex properties?

How would that xaml substitute for TabControl look like ?

danwalmsley
@danwalmsley
Dec 11 2015 11:23
can a new TabControl... not contain the substitute Xaml?
Steven Kirk
@grokys
Dec 11 2015 11:29
it would look something like this:
<StackPanel Orientation="Vertical">
    <TabStrip Name="tabStrip">
      <TabStripItem>Foo</TabStripItem>
      <TabStripItem>Bar</TabStripItem>
    </TabStrip>
    <Carousel SelectedIndex="{Binding #tabStrip.SelectedIndex}">
      <StackPanel>
        <!-- page Foo content -->
      <StackPanel>
      <StackPanel>
        <!-- page Foo content -->
      <StackPanel>
    </Carousel>
  </StackPanel>
can a new TabControl... not contain the substitute Xaml?
you'd think so wouldn't you?
however consider how a TabItem is displayed
it's cut into Header and Content and displayed in two different places
how would you do that in the XAML above?
Steven Kirk
@grokys
Dec 11 2015 11:36
so the problem isn't that TabControl can't contain the simplified XAML, it's that TabControl as it stands can't be expressed in XAML
i'm not seriously suggesting removing it (half seriously ;) ) but it's causing me headaches
Wiesław Šoltés
@wieslawsoltes
Dec 11 2015 12:16
<StackPanel Orientation="Vertical">
    <TabStrip Name="tabStrip">
      <TabStripItem>Foo</TabStripItem>
      <TabStripItem>Bar</TabStripItem>
    </TabStrip>
    <Carousel SelectedIndex="{Binding #tabStrip.SelectedIndex}">
      <StackPanel>
        <!-- page Foo content -->
      <StackPanel>
      <StackPanel>
        <!-- page Foo content -->
      <StackPanel>
    </Carousel>
  </StackPanel>
how is that different in logical tree from this :
    <Setter Property="Template">
      <ControlTemplate>
        <Grid RowDefinitions="Auto,*">
          <TabStrip Items="{TemplateBinding Items}"
                    SelectedIndex="{TemplateBinding Path=SelectedIndex, Mode=TwoWay}"/>
          <Carousel Items="{TemplateBinding Items}"
                    MemberSelector="Content"
                    SelectedIndex="{TemplateBinding Path=SelectedIndex}"
                    Transition="{TemplateBinding Transition}"
                    Grid.Row="1"/>
        </Grid>
      </ControlTemplate>
    </Setter>
Darnell Williams
@Seeker1437
Dec 11 2015 12:25
Oh no lol, please keep it, haha
I wonder how the TabControl can be corrected.
Steven Kirk
@grokys
Dec 11 2015 12:29
@wieslawsoltes the difference is there is no TabItem which is displayed in both the tab strip and the "content" area
i think i know what i have to do to fix it however
Darnell Williams
@Seeker1437
Dec 11 2015 12:31
The TabItem should only technocally be shown im the tab strip, then the contemt is databound to the contect property of the item
Steven Kirk
@grokys
Dec 11 2015 12:34
yes, but this is the problem: the content is a logical child of the TabItem but its not displayed inside the TabItem so it can't be its logical child
anyway, like i said i think i know how to solve it. it's just a PITA
as no other control works like this
Darnell Williams
@Seeker1437
Dec 11 2015 13:13
aaah weird
danwalmsley
@danwalmsley
Dec 11 2015 21:37
do we have any support for a kind of simple drop shadow effect
I want to get one around my Window...
Im trying to use border... and in WPF I was able to apply a drop shadow
Darnell Williams
@Seeker1437
Dec 11 2015 22:16
You mean like glow effect?
like the VS glow effect around the edges
danwalmsley
@danwalmsley
Dec 11 2015 22:59
yes
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:20
Nope, we don't have that
We need support from drawing subsystem to do that
danwalmsley
@danwalmsley
Dec 11 2015 23:21
@kekekeks how can I use an image with source in a resource?
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:22
Honestly I have no idea
danwalmsley
@danwalmsley
Dec 11 2015 23:22
hmmm but in theory it should be supported?
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:22
Definetely
We haven't touched our asset loader for ages
and it needs some refactoring and proper uri parsing
danwalmsley
@danwalmsley
Dec 11 2015 23:24
<Image Source="resource://application/AvalonStudio/AvalonStudio.Resources.Icons.Templarian.dark.appbar.3d.3ds.png" />
trying this.
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:25
Yep, something like that
BTW, we decided to use res: scheme

Regarding DropShadow:

All methods require content to be drawn in intermediate bitmap first and we don't have support for that yet. I'm also afraid that there won't be implementation for Cairo since I have no intention of wasting my time on it doing it and I don't see anybody else who would

danwalmsley
@danwalmsley
Dec 11 2015 23:27
sure np
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:27
And to make it available to all platforms I need to port skia to OS X first
So don't expect that until late January or something
danwalmsley
@danwalmsley
Dec 11 2015 23:28
it can wait..tbh I was hoping I might just be able to fake it with some clever use of border... and a special brush type
I couldnt specify BorderThickness = "0 0 1 1"
I expected that to give no border left and top and just on the bottom and right
but it doesnt like that syntax
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:29
Try with ,
We kinda short on staff here, so low-level stuff like rendering and windowing isn't moving really fast
danwalmsley
@danwalmsley
Dec 11 2015 23:30
do you know how the resource url is structured?
I cant get it to find my images files... they are compiled as resource
but is the url addressing folders
or addressing namespace?
This is the planned uri format
Isn't fully implemented yet, but some things should work
danwalmsley
@danwalmsley
Dec 11 2015 23:37
do you think its working...
Error loading XAML: SharpDX.SharpDXException: HRESULT: [0x8007007B], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The filename, directory name, or volume label syntax is incorrect.
but sharpdx has a problem?
<Image Source="res:///AvalonStudio/Resources.Icons.Templarian/dark.appbar.3d.3ds.png" />
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:38
It seems that we don't support image loading using asset loader yet
Argh, so many things to implement
danwalmsley
@danwalmsley
Dec 11 2015 23:39
ah yeh
hmmm actually with that format
danwalmsley
@danwalmsley
Dec 11 2015 23:39
the filename has . init
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:39
Yep, it always tries to load bitmap from file
danwalmsley
@danwalmsley
Dec 11 2015 23:39
so full.path.to.resource
would that not confuse it?
im i'll just have icons copy to output for now
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:40
It would, but currently we are stuck with EmbeddedResource
At some point we'll implement MSBuild task that will create internal mappings for resources
So we'll get proper filesystem tree information
danwalmsley
@danwalmsley
Dec 11 2015 23:44
<ImageBrush Source="Resources/Icons/Templarian/dark/appbar.3d.3ds.png" />
doesnt seem to work either...
I will create issues for this
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:44
Perspex/Perspex#358 tracking that here
I'll see into it this weekend (which technically already has began)
danwalmsley
@danwalmsley
Dec 11 2015 23:46
I had xaml versions of all these icons...
which are <Canvas>
but we dont implement the Clip property
so I cant use them without taking Clip out of all of them
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:46
Ehm? ClipToBounds should work
danwalmsley
@danwalmsley
Dec 11 2015 23:46
let me show you an example..
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="appbar_3d_3ds" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
    <Path Width="32" Height="40" Canvas.Left="23" Canvas.Top="18" Stretch="Fill" Fill="#FF000000" Data="F1 M 27,18L 23,26L 33,30L 24,38L 33,46L 23,50L 27,58L 45,58L 55,38L 45,18L 27,18 Z "/>
</Canvas>
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:47
Oh
danwalmsley
@danwalmsley
Dec 11 2015 23:47
if I remove the clip
it actually draws
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:48
Yep, got it
We don't have Path-based clipping
danwalmsley
@danwalmsley
Dec 11 2015 23:48
ok
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:48
File an issue for that
danwalmsley
@danwalmsley
Dec 11 2015 23:48
ok will do
done...
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:49
@grokys I think we should focus on skia backend (or just drop Cairo while keeping Direct2D) for the time being, since there is still a lot of stuff to implement and it will be a bit hard to do for 3 (three) rendering backends
Nikita Tsukanov
@kekekeks
Dec 11 2015 23:58
@grokys
Regarding AssetLoader. How should we support loading stuff from files located in file system?
Relative uris are reserved for res: