ItemsPanelRoot Docs
If ItemsPanel is a template of StackPanel by default (see docs), then shouldn't ItemsPanelRoot return an instance of StackPanel by default?
It looks like it's null because I haven't yet set ItemsSource. Additionally, even if ItemsSource is set, I need to wait for the Loaded event.
Related
My problem is the following:
I wish to make a sprite visible once a button is pressed, other forums I visited suggested I did visible = false, but that didn't work, others said I should use self.visible = false, but that didn't work either.
I connected the pressed signal of the button to the sprite but the problem comes when I have to change the visibility.
What should I use that will work?
Either setting the 'visible' property to true/false or using the hide()/show() methods should work. There's no apparent reason for any of them 'not working' aside from that maybe you are calling the methods or setting the properties in the wrong object.
Try again in a minimal test scene: A scene with only one node, with a sprite node as the root, and use any texture (like the default icon.png) on it. Attach a built-in script to the node and on the _ready() function try hiding it with 'hide()' or 'visible = false'
I can copy the default style from there and modify it to set the CornerRadius of the borders.
However, I find it heavy. Isn't there a way to just tell my TextBox to use a ControlTemplate to derive from the default one with "just" a property changed?
This idea is easily understood, say when defining a new Style, it can be based on another Style with a few properties being overridden. This fits well into the inheritance scenario in OO.
But ControlTemplate has no such thing as "base ControlTemplate", because ControlTemplate isn't really a set of properties/behaviors that can be overridden, ControlTemplate is an integral entity, comprising of different template parts. Putting in OO analogy, it is like a class that doesn't expose any virtual method for you to override.
So you have to edit on the entire copy of the original template.
There are four binding modes in Aurelia as documented:
.bind - Uses the default binding. One-way binding for everything but
form controls, which use two-way binding.
.one-way - Flows data one
direction: from the view-model to the view.
.two-way - Flows data
both ways: from view-model to view and from view to view-model.
.one-time - Renders data once, but does not synchronize changes after
the initial render.
I'm looking for a .one-way binding but the other way around, with the data flow from view to view-model. My use-case is dirty-bit where you want to know when the view is dirty.
ValueConverters are bidirectional and could possibly be an OK workaround until it is implemented as described in the issue Jeremy linked to.
http://aurelia.io/hub.html#/doc/article/aurelia/binding/latest/binding-value-converters/1
you can use attribute.from-view="variable" for a one way binding from view to viewmodel
https://github.com/aurelia/binding/pull/618
I am experiencing issues with BindableApplicationBar in windows phone.
I have added the BindableApplicationBarMenuItem from code behind with
text
IsEnabled property
Visibility property
when I RaisePropertyChanged event for visibility attached property, it works fine.
But when I am trying fire RaisePropertyChanged event for IsEnabled attached property is doesn't work.
So how can I fire the RaisePropertyChanged event for IsEnabled attached property in case of BindableApplicationBarMenuItem.
or is there any other way to get the updated property value ?
I have more than one PasswordBox on my view and I want to pass all their SecureStrings to my view model when I click a button.
My guess is that I want to populate an instance of a custom class with all the SecureStrings and pass that object as a parameter to the RelayCommand bound to the button.
If I only knew how...
My current idea for a work around:
In the RelayCommands action for the button: send out a NotificationMessageAction with a callback taking a custom class as parameter.
Register for that message in the views code behind, and then populate an object with the SecureStrings, and then pass that object back to the view model with the help of the callback. Not very nice...
There must be a better way to do this in XAML, right?
Actually, I think what you want to do is implement event handlers, or an attached behavior on your PaswordBoxes that will push the SecureStrings to properties in the same viewmodel object that will be handling the RelayCommand's action. Then your RelayCommand won't need any parameters at all.