These are chat archives for AvaloniaUI/Avalonia

26th
Jan 2015
José Manuel Nieto
@SuperJMN
Jan 26 2015 20:11
Hey! how can I retrieve a list of Attached Properties that are set explicitly for a given object?
Steven Kirk
@grokys
Jan 26 2015 21:03
you can use PerspexObject.GetRegisteredProperties() to get a list of the properties that are applicable for a type
or you can use PerspexObject.GetAllValues() to get the values of all properties and their values on an object
from the PerspexPropertyValue returned from GetAllValues you can see if a property is set locally by testing the PriorityValue property
look at Perspex.Diagnostics/ViewModels/ControlDetails.cs:20 to see how the diagnostics window works out where the value comes from
is that what you need?
you can tell attached properties from normal ones because they have a name like Grid.Column
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:24
thanks for the answer!
I'm inspecting the GetAllValues
so the only way to distinguishan Attached Property is to look for any dot in the name of the property? :)
This message was deleted
Steven Kirk
@grokys
Jan 26 2015 21:26
Currently yes
Why do you need to distinguish them?
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:27
because the tree replicator needs to set them :)
currently I use this:
    private void CopyExplicitlySetDPs(PerspexObject source, PerspexObject cloned)
    {
        var setValues = source.GetSetValues();
        foreach (var value in setValues)
        {
            if (value.Item3 == BindingPriority.LocalValue)
            {
                var targetProperty = value.Item1;
                cloned.SetValue(targetProperty, value.Item2);
            }
        }
    }
do you think I can generalize?
Steven Kirk
@grokys
Jan 26 2015 21:30
ah i'd forgotten about GetSetValues
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:31
I'm looking at it now!
haha
Steven Kirk
@grokys
Jan 26 2015 21:31
that should return a collection of PerspexPropertyValues instead of tuples
but that's not important
This message was deleted
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:32
so...
Steven Kirk
@grokys
Jan 26 2015 21:32
what do you want to generalize it to?
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:32
how do I filter them to get only the explicity set values?
Steven Kirk
@grokys
Jan 26 2015 21:32
that looks correct to me
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:33
   var explictlySetProperties  = source.GetAllValues().Where(value => value.PriorityValue.ValuePriority == WHAT? )
Steven Kirk
@grokys
Jan 26 2015 21:33
no, i think you're good with GetSetValues
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:33
but with that you don't get the attached properties
Steven Kirk
@grokys
Jan 26 2015 21:34
oh don't you?
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:34
let me see!
Steven Kirk
@grokys
Jan 26 2015 21:34
you should
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:35
oh my...
haha, I'm dumb!
it does retrieve them
uhmm, but the value of Grid.Column is not a number .. :S
Steven Kirk
@grokys
Jan 26 2015 21:38
really? what is it?
This message was deleted
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:38
it's this!
let me capture it
Untitled.png
well, I'm not sure what's going on there
Steven Kirk
@grokys
Jan 26 2015 21:40
are you sure that's the correct property? it looks to me like that's the Parent property you're looking at
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:41
argh, I have to double check. I think I'm watching the wrong object
sorry!
you wouldn't believe how I'm debugging right now
(not even well seated!)
Steven Kirk
@grokys
Jan 26 2015 21:41
i've made GetSetValues return PerspexPropertyValues in master now
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:41
(we've got guests... and I don't have enough room!)
Steven Kirk
@grokys
Jan 26 2015 21:41
:)
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:41
(to sit)
haha
this is how to debug badly and get a cool spine ache!
Steven Kirk
@grokys
Jan 26 2015 21:42
haha, i agree,
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:42
I'm going to die young
haha
Steven Kirk
@grokys
Jan 26 2015 21:42
and alienate your guests ;)
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:45
I seems the property is set correctly
(Grid.Column)
but this is the result:
Untitled2.png
the button has this markup:
 <Button Content="{Binding Path=Surname}" Grid.Column="1" Margin="1,2,3,4" />
and the Grid contains 2 columns
José Manuel Nieto
@SuperJMN
Jan 26 2015 21:50
OK, I've checked the cloned item and I correctly set the value of the attached property (Grid.Column)
maybe it doesn't update the column when it's changed?
Steven Kirk
@grokys
Jan 26 2015 22:11
ah yeah that's possible
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:12
I've tried to check using F12 (Dev Tools) but the window doesn't appear, or worse, when it appears, it hangs the application (it shakes continuously!)
Steven Kirk
@grokys
Jan 26 2015 22:12
you can use the dev tools to see if it's set correctly though
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:12
(the dev window)
yes, I tried, but it doesn't show correctly :(
Steven Kirk
@grokys
Jan 26 2015 22:13
oh really? bugs bugs everywhere ;)
what does that dev tools show?
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:13
anything!
it repains itself non-stop!
Steven Kirk
@grokys
Jan 26 2015 22:13
oh...
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:13
I'm using your main branch
it starts to shake
Steven Kirk
@grokys
Jan 26 2015 22:14
hmm
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:14
appears empty
and hangs the application
it seems it enter some kind of render lock
Steven Kirk
@grokys
Jan 26 2015 22:15
hmm yes it seems to currently be broken :(
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:15
have you seen it?
Steven Kirk
@grokys
Jan 26 2015 22:15
well it doesn't work on the main test application on main currently it seems
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:16
oh, so testing the Grid.Column issue would be a bit harder
Steven Kirk
@grokys
Jan 26 2015 22:17
yeah, i need to fix that
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:17
maybe the Grid.Column is OK, but it doesn't reflect the changes
Steven Kirk
@grokys
Jan 26 2015 22:19
could be
José Manuel Nieto
@SuperJMN
Jan 26 2015 22:26
I'll try to find out tomorrow!
it's late here, I've got to have some repairing sleep
:) see you tomorrow have a good night!
thanks for the help!!
Steven Kirk
@grokys
Jan 26 2015 22:27
sure. good night!
Steven Kirk
@grokys
Jan 26 2015 23:36
ok, i've hacked together a temporary fix for dev tools.