These are chat archives for AvaloniaUI/Avalonia

10th
Dec 2015
danwalmsley
@danwalmsley
Dec 10 2015 10:46 UTC
hello... im trying to add a ContentPresenter to my control to allow the user to overlay their own UserControls
this is my control template with added ContentPresenter...
<Grid Margin="0 0" ColumnDefinitions="Auto, *">
                <StackPanel Orientation="Horizontal" Name="marginContainer"/>
                <tv:TextView Name="textView" HorizontalAlignment="Stretch" Margin="0, 0" Grid.Column="1" 
                                CaretIndex="{TemplateBinding CaretIndex}"
                                SelectionStart="{TemplateBinding SelectionStart}"
                                SelectionEnd="{TemplateBinding SelectionEnd}"
                                Foreground="{TemplateBinding Foreground}"
                                TextDocument="{TemplateBinding TextDocument}"/>
                <ContentPresenter Content="" />
              </Grid>
what do I set the content to and what type do I need to add to my perspex property to allow that to be filled from Xaml?
ok... I think I just need to inherit from content control instead of templated control..
danwalmsley
@danwalmsley
Dec 10 2015 10:55 UTC
ok that works...
but it intercept my mouse clicks
blob
 <Grid Margin="0 0" ColumnDefinitions="Auto, *">
                <StackPanel Orientation="Horizontal" Name="marginContainer"/>
                <tv:TextView Name="textView" HorizontalAlignment="Stretch" Margin="0, 0" Grid.Column="1" 
                                CaretIndex="{TemplateBinding CaretIndex}"
                                SelectionStart="{TemplateBinding SelectionStart}"
                                SelectionEnd="{TemplateBinding SelectionEnd}"
                                Foreground="{TemplateBinding Foreground}"
                                TextDocument="{TemplateBinding TextDocument}"/>
                <ContentPresenter Content="{TemplateBinding Content}" Grid.Column="1"
                           Margin="{TemplateBinding Margin}"
                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
              </Grid>
so the red bit is my content presenter... it only covers a small portion of the editor... but editor no longer receives mouse clicks...
Steven Kirk
@grokys
Dec 10 2015 11:00 UTC
i think that's because we don't yet have mouse transparency implemented
danwalmsley
@danwalmsley
Dec 10 2015 11:01 UTC
I set HorizontalAlignment and VerticalAlignment to Left and Top
and this enables mouse click below and to the right of the red bit
but not above or to the left of it
what would be the effect of IsHitTestVisible?
ah yes
that works
Steven Kirk
@grokys
Dec 10 2015 11:02 UTC
ok cool ;)
danwalmsley
@danwalmsley
Dec 10 2015 11:02 UTC
IsHitTestVisible = false and clicks just fall through to whatever is behind!!
ended up answering my own question
thanks @grokys
Steven Kirk
@grokys
Dec 10 2015 11:21 UTC
np, i didn't do anything ;)
IsHitTestVisible should work the same as WPF
danwalmsley
@danwalmsley
Dec 10 2015 11:31 UTC
im wondering how to get my usercontrol to handle keydown events..
code behind is not receiving keypress events...
not sure if my control should have a keydown ICommand property?
then user control binds to an ICommand in viewmodel
ah e.handled was set in control
Denis
@susloparovdenis
Dec 10 2015 12:05 UTC
I wanted to fix bug #324. Now I see that GridSplitter is actually working as HorizontalGridSplitter. I think it's better to create two different: HorizontalGridSplitter and VerticalGridSplitter, because in WPF it's kind of ambiguous. You should set VerticalAlignment or HorizontalAlignment, it defines the behavior. How do you think?
Steven Kirk
@grokys
Dec 10 2015 13:01 UTC
i agree that the API in WPF is horrible, but i'm not sure about two separate controls. wouldn't just an Orientation property work, the same as with StackPanel?
Darnell Williams
@Seeker1437
Dec 10 2015 13:04 UTC
@susloparovdenis I disagree
Darnell Williams
@Seeker1437
Dec 10 2015 13:10 UTC
The way ti worked to me was pretty neat
Oh I see.
Hmmm Actually @grokys @susloparovdenis I see what you mean now, yeah Orientation would probably be better than gridsplitter could do the rest automagically :D
Denis
@susloparovdenis
Dec 10 2015 14:15 UTC
I've already seperated them. I found several advantages in seperating them, and no disadvantages
  • It looks more clearer in xaml
  • So it does in implementation
  • Styling is different, with different properties. For HorizontalGridSplitter you should set Height, for 'VerticalGridSplitter' 'Width'
  • Look at those nice dots :)
small lib perhaps useful for someone, https://www.nuget.org/packages/Gu.ChangeTracking/1.0.0
Darnell Williams
@Seeker1437
Dec 10 2015 14:38 UTC
@susloparovdenis If you have to committed somewhere, I would love to play withit.
Gridsplitter is crucial to my docking system, I am not sure if it being seperated would break what I have so far XD
There are prefomance issues yet.
Denis
@susloparovdenis
Dec 10 2015 14:55 UTC
I suggest attached property like Gird.Pos="2,1,2,3" for Grid.Column="2" Grid.Row="1" Grid.ColumsSpan="2" Grid.RowSpan="3"
Darnell Williams
@Seeker1437
Dec 10 2015 14:56 UTC
hmmm
danwalmsley
@danwalmsley
Dec 10 2015 15:21 UTC
@susloparovdenis looks pretty neat
Darnell Williams
@Seeker1437
Dec 10 2015 15:21 UTC
I think this will do VERY VERY well :D
Darnell Williams
@Seeker1437
Dec 10 2015 16:13 UTC
@grokys what is our equivalent if UIElement?
Steven Kirk
@grokys
Dec 10 2015 16:21 UTC
that'd be Control
@susloparovdenis cool!
still not sure about having two separate controls to do the same thing though...
thoughts anyone else?
Nikita Tsukanov
@kekekeks
Dec 10 2015 16:29 UTC
Well, I don't like that you need to supply two separate styles for them
But we don't have LayoutTransform, so it's kinda inevitable
Denis
@susloparovdenis
Dec 10 2015 16:32 UTC
pool request?
Darnell Williams
@Seeker1437
Dec 10 2015 16:34 UTC
thanks @grokys and last but not least, our equivalent of FrameworkElement
danwalmsley
@danwalmsley
Dec 10 2015 16:34 UTC
@grokys I think a single control would be better.... but when I looked at it.. the orientation seemed to be defined by if the splitter was positioned between 2 rows or 2 columns... so perhaps you wouldnt need an orientation? or maybe thats how the wpf one works... which confused me completely!
Steven Kirk
@grokys
Dec 10 2015 16:35 UTC
FrameworkElement = Control again
Darnell Williams
@Seeker1437
Dec 10 2015 16:35 UTC
oh nice thanks so I was just doubting myself a bit XD
Steven Kirk
@grokys
Dec 10 2015 16:35 UTC
i never understood the difference between the two in WPF so there's no distinction
@danwalmsley i can never remember how the WPF one works, it's really confusing
danwalmsley
@danwalmsley
Dec 10 2015 16:36 UTC
to get a single control can the template not workout what orientation it is and make the horizontal version hidden or the vertical one hidden
effectively wrapping @susloparovdenis solution into a single one?
Darnell Williams
@Seeker1437
Dec 10 2015 16:37 UTC
I know the difference between them :O
either way, Control is the way to go I think, makes it a bit more simple
Darnell Williams
@Seeker1437
Dec 10 2015 16:43 UTC
UIElement basic visual stuff, basic input, measure, arrange, (abstract margin, minwidth, other virtual functions)
FrameworkElement styling, databinding, object tree, object lifetime, margin, mindwidth
Darnell Williams
@Seeker1437
Dec 10 2015 16:52 UTC
@grokys I keep asking questions.... grr anyways, I noticed Window does nto have any static things like Window.GetWindow(), is there another place this is held?
Nikita Tsukanov
@kekekeks
Dec 10 2015 16:53 UTC
GetWindow?
I'm not sure that it's implemented
Steven Kirk
@grokys
Dec 10 2015 16:54 UTC
things like input, layout etc are implemented in the InputElement, Layoutable etc classes but you never want to use them by themselves
to get the window for a control, you can use control.GetSelfAndVisualAncestors().OfType<Window>().First()
Darnell Williams
@Seeker1437
Dec 10 2015 16:58 UTC
Ah okay, and what of DIspatcher?
I thought it would but GetSelf, but I wasn't sur ehow to only get the window so that rocks.
Basically, I tear my dock item, it creates a new window of the same type of the items parent window then from there I need to be able to access the dispatcher
Darnell Williams
@Seeker1437
Dec 10 2015 17:05 UTC
Oh reading hes a lot sorry guys
Darnell Williams
@Seeker1437
Dec 10 2015 17:27 UTC
What is the practice for manipulating items contained within an ItemsControl?
Steven Kirk
@grokys
Dec 10 2015 18:52 UTC
sorry @ImaBrokeDude i have no idea what you are asking
Andrey Kunchev
@donandren
Dec 10 2015 18:56 UTC
@grokys do you have plans to implement LayoutTransform or for example only a single LayoutTransform control?
Steven Kirk
@grokys
Dec 10 2015 18:56 UTC
not sure about LayoutTransform yet - CSS/html seems to do ok without it
it'd add a load of complexity so I'm not sure would be worth it
a single layout transform control sounds interesting though. what would it involve?
Andrey Kunchev
@donandren
Dec 10 2015 18:57 UTC
sure I think I can help writing a LayoutTransformControl
not sure only about mouse input, but the initial version can be without proper mouse input handling
are you ok with that?
and completelly agree that LayoutTransform on every control can add unnessesary complexity of the base classes
Steven Kirk
@grokys
Dec 10 2015 19:03 UTC
yeah, sounds good! i'd like to see an implementation
Andrey Kunchev
@donandren
Dec 10 2015 19:06 UTC
sure in the next days i think it should be ready.
Also are you ok with adding some small new stuff like:
  1. Expander
  2. PathGeometry like WPF (inherit Streamgeometry) with objects for Arc, line etc. so these can be defined in xaml
    3.ScaleTransform
Steven Kirk
@grokys
Dec 10 2015 19:10 UTC
definitely!
those things are all needed
Andrey Kunchev
@donandren
Dec 10 2015 19:14 UTC
great I'll start work for these features
Darnell Williams
@Seeker1437
Dec 10 2015 19:19 UTC
@grokys the Items Property is an IEnumerable so I can't do things like Items.Clear() and such
Steven Kirk
@grokys
Dec 10 2015 19:19 UTC
that's the same as in WPF
Nikita Tsukanov
@kekekeks
Dec 10 2015 19:20 UTC
Guys, if anyone wants to contribute to our Skia backend and for some reason wants to do it on Linux/Mac, we have a spare license for CLion IDE
Steven Kirk
@grokys
Dec 10 2015 19:20 UTC
you will usually bind it to a VM property
if not, cast it to the concrete type and do Clear() etc on that
also see #54
Darnell Williams
@Seeker1437
Dec 10 2015 19:23 UTC
hmmmmmmm interesting
Actually I like that :O
Nikita Tsukanov
@kekekeks
Dec 10 2015 19:29 UTC
@grokys using ICollection seems to be a good solution
Steven Kirk
@grokys
Dec 10 2015 19:39 UTC
yeah, the only thing i wasn't sure about was if all common collection classes implement that
i was concerned because ICollection<T> doesn't implement ICollection: https://msdn.microsoft.com/en-us/library/92t2ye13(v=vs.110).aspx
Darnell Williams
@Seeker1437
Dec 10 2015 22:47 UTC
@grokys @kekekeks is there a way to enumerate all of the available PerspexPropertys in a PerspexObject?
danwalmsley
@danwalmsley
Dec 10 2015 23:07 UTC

@grokys @kekekeks I think what @ImaBrokeDude is trying to ask is this...

In his docking control, when a Docked item becomes undocked i.e. floating

like this in VS.
blob
how does he maintain the databinding of the viewmodels and controls that are contained within it...
since it will now be in a seperate window with its own visual and logical trees
?
Steven Kirk
@grokys
Dec 10 2015 23:24 UTC
@danwalmsley i can't see where he asks that? anyway - set the DataContext at the level of the control that will be detached/attached
Darnell Williams
@Seeker1437
Dec 10 2015 23:26 UTC
oh lol and can it tell me if a databinding exist on it or not?
yeah i figured out to just copy the datacontext
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:39 UTC
I think we should try to port AvalonDock
instead of inventing our own dock implementation
danwalmsley
@danwalmsley
Dec 10 2015 23:41 UTC
@kekekeks its a huge undertaking I think
could be possible...
avalonedit had lots of stuff that would need to be re-written for a direct port... not sure about avalondock
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:43 UTC
It's better than writting one from scratch
May be we need some kind of auto-porting tool that will use roslyn to replace references
danwalmsley
@danwalmsley
Dec 10 2015 23:44 UTC
wow that would be pretty cool
forexample on avalonedit... it was hugely reliant on lots of Windows text rendering and formatting stuff..
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:45 UTC
And some compatibility classes (marked as internal) to be included to the project
danwalmsley
@danwalmsley
Dec 10 2015 23:45 UTC
like TextRuns, etc
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:45 UTC
We don't have that yet
danwalmsley
@danwalmsley
Dec 10 2015 23:45 UTC
and bits that are just not available on mono
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:45 UTC
No text document model at all
danwalmsley
@danwalmsley
Dec 10 2015 23:46 UTC
thats why i just took out the TextDocument part... which is top notch btw
but all the rendering stuff started from scratch
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:46 UTC

and bits that are just not available on mono

Ehm? Are you still talking about stuff from PresentationCore?

Darnell Williams
@Seeker1437
Dec 10 2015 23:46 UTC
ah man XD
danwalmsley
@danwalmsley
Dec 10 2015 23:46 UTC
but based on what id learnt from avalon edit.. so it was fairly similar architecture...
Darnell Williams
@Seeker1437
Dec 10 2015 23:46 UTC
well I will still write mine too because it would help me learn Perspex a bit more then :P
danwalmsley
@danwalmsley
Dec 10 2015 23:46 UTC
but simplified down
Darnell Williams
@Seeker1437
Dec 10 2015 23:46 UTC
you guys do what you want XD
danwalmsley
@danwalmsley
Dec 10 2015 23:47 UTC
@ImaBrokeDude I think you should keep going... im not sure anyone will have the resources to port avalondock any time soon
@kekekeks im wondering again about hiding window chrome?
any new thoughts on that?
even if it was just windows at first?
Nikita Tsukanov
@kekekeks
Dec 10 2015 23:57 UTC
That will be easy to implement
Proper client decorations support will take time through
what do you need it for?
Darnell Williams
@Seeker1437
Dec 10 2015 23:59 UTC
floating tool windows
kind of like the beforementioned window
This message was deleted