Fetch the values from NSArrayController

I am struggling to fetch the selected values from NSPopupbutton.Please find the below code

public override void AwakeFromNib ()
        {
            base.AwakeFromNib ();
            values = new object[] {"Joe Smith",1};
            addNewPerson (values);
            // select the first popup menu item
            arrayController.SelectionIndex = 0;
        }

        private void addNewPerson(object[] properties)
        {
            arrayController.AddObject (new Question (properties));          
        }

        public new MainWindow Window 
        {
            get { return (MainWindow)base.Window; }
        }
        partial void DisplayValue (AppKit.NSButton sender)
        {
            Console.WriteLine(arrayController.SelectedObjects[0]);
        }
}

I got the below response when i run the DisplayValue method

arrayController.SelectedObjects[0]
{}
Age: 3
Attributes: Count = 2
Class: {ObjCRuntime.Class}
ClassHandle: 0x746200f0
DebugDescription: ""
Description: ""
Handle: 0x20f640
IsProxy: false
Name: "Sally Sixpack"
RetainCount: 5
Self: {}
SuperHandle: 0x2785938
Superclass: {ObjCRuntime.Class}
Zone: {Foundation.NSZone}
Static members:
Non-public members:

How to get the Age and Name values from the resposnse

Tagged:

Best Answer

Answers

  • VinayahamoorthyVVinayahamoorthyV USMember

    You are correct..Just casting with Question object..It is working fine now

Sign In or Register to comment.