How to get updated property values for BindableApplicationBarMenuItem? - xaml

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 ?

Related

Set visibility through script. Godot

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'

Custom event handling in Objective-c

I need to call a block on [cmd+double-click] event from NSTableView. I know about the -setDoubleAction: API to set the selector for the double-click event & -keyDown: delegate method for handling key press events.
What I need is kind of a combination of these 2 in a single customised event handler. Any pointers would be really appreciated.
Is there any way to register for such a custom event setting a callback selector?
I'm not sure, if that is good enough for you, but I'd declare a BOOL property, which I set to 'YES' at the keyDown event for the desired key and set to 'NO' at the keyUp event.
In the action for the double click event I'd check the BOOL property, if it's 'YES' -> do the thing otherwise return.

Where is implementation of PropertyChanged EventHandler?

Im a bit confused. I dont understand what code is actually is executed when I implement INotifyPropertyChanged interface.
As i imagine the chain goes like this:
My class impliments
INotifyPropertyChanged=>
Every property`s setter calls
NotifyPropertyChanged method=>
PropertyChangedEventHandler
invokes=>???
And i wonder what code makes my control rerender.
Thanks.
The control will subscribe to the event when it binds. When you raise the event, the control will check whether the property that's been changed is one of the ones it cares about. If it is, it will fetch the new value of the property, and rerender itself.
Of course, the handler doesn't have to be to do with controls rerendering - they can do anything. It's just a way of saying, "Hey, property X has changed its value... if you care about that, do something." You can add your own handlers very easily, just like any other event handlers.

MVVM light - Passing multiple parameters in RelayCommand from XAML

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.

NSDatePicker - getting the value when it is changed

How would I get notified of a value of a NSDatePicker, when it's changed?
I've only done it on the iPhone with UIDatePicker but it is similar on the Mac, you register as a delegate and receive messages. See Apple's Docs here.
I should clarify, this tells you when it changed, you still need to call -dateValue to get the date.
The same you would any other control. Options are:
Target/Action
Binding
Observe notification
Delegate
You can bind the picker's value binding to a property of your controller, or a property of a model object (through a controller).