Set dataSource of ListView programmatically - windows-8

I'm trying to update a windows 8 application from the Developer Preview to the Consumer Preview. It seems there's been a few changes. This code used to work:
var myDataSource = new WinJS.UI.ArrayDataSource(array)
var basicListView = WinJS.UI.getControl(document.getElementById("basicListView"));
basicListView.dataSource = myDataSource;
Now, there is no WinJS.UI.getControl method and no ArrayDataSource. This is my code:
var dataList = new WinJS.Binding.List(array);
var list = document.getElementById("basicListView");
list.itemDataSource = dataList.dataSource;
but it does nothing (except add a property to a DOM element that is ignored). Any ideas what I'm missing?

Got it. To get the control you now use the winControl property of the element:
var list = document.getElementById("basicListView").winControl;
Setting the itemDataSource works a treat.

Related

how to access elements not read by FlaUI using UIA2 or UIA3?

How to access/Find elements not read by FLAUI using UIA2 or UIA3?
since FLAUIInspect does not show up any of the available element under the window (while inspect.exe shows all available elements) FindAll (Children/Descendants) will not give any element.
is there a wat to get these elements using FLAUI??
First, you have to access the element you need to see. On your case, the ""pane it's a Control Type Panel inside the main window, so you gonna have to do something like this:
var automation = new UIA3Automation();
var app = FlaUI.Core.Application.Attach(application.Process.Id); //Here you can attach or start a application by path
var window = app.GetMainWindow(automation); //Get hold of the window
var allObj = window.FindAllChildren();
var panel = allObj.Where(x => x.AutomationId == "16386096").FirstOrDefault().FindAllChildren(); //Here you can use other property unique to the panel, I used the AutomationId for example
After you get hold of the panel, you can now find all the children objects.emphasized text
You need to expose the AutomationPeer for that element which is not being found by FlaUI

How can I get carousel on page at Umbraco?

I want to create a carousel, firstly I create a nested content then I added it on my homepage but when I called, it's not working.
#{
string carouselId = "mainCarousel";
IEnumerable<IPublishedContent> carousel = Model.Value<IEnumerable<IPublishedContent>>(carouselId); }
I got error like this object reference not set to an instance of an object. I tried many things but I failed to reach on solve. Btw I'm using v8.1.12.
I fixed this problem with this code;
var page = Umbraco.Content(Guid.Parse("eea1803b-f093-42f6-8483-b27df3323c2d"));
var carousel = page.Value<IEnumerable<IPublishedElement>>("mainCarousel");

How to show Grid Lines in Open Office Draw permanently

I am programmatically drawing a flowchart using Java UNO Runtime Reference in which I want to display grid Lines permanently.Using following code I was able to display the Grid Lines but they are toggled ON and OFF alternately when the code executes.
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xDrawDoc);
XController xController = xModel.getCurrentController();
XDispatchProvider xDisp = UnoRuntime.queryInterface(XDispatchProvider.class, xController);
XMultiComponentFactory xMCF = xContext.getServiceManager();
Object dispatchHelper = xMCF.createInstanceWithContext("com.sun.star.frame.DispatchHelper", xContext);
XDispatchHelper xDispatchHelper = UnoRuntime.queryInterface(XDispatchHelper.class, dispatchHelper);
PropertyValue[] navigatorDesc = new PropertyValue[1];
navigatorDesc[0] = new PropertyValue();
navigatorDesc[0].Name = "GridVisible";
navigatorDesc[0].Value = true;
xDispatchHelper.executeDispatch(xDisp, ".uno:GridVisible" , "", 0, navigatorDesc);
I want to permanently show Grid Lines.How can I achieve this using Java.Pls suggest. If there is any way of checking whether the Grid Lines are ON(any method which could return a boolean value), this could also be a useful approach.

flex air open new nativewindow null objecthen

i add a new window in windowapplication,i did by nativeWindow,but when i debug this,the new window's content is always not loading completely.
the following is the error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
i did add the creation_complete event,but it still not work.
why?someone could help?
opts = new NativeWindowInitOptions();
opts.resizable=false;
opts.maximizable=false;
win = new NativeWindow(opts);
win.alwaysInFront=true;
var newWindow:TestWindow=new TestWindow();
newWindow.addEventListener(FlexEvent.CREATION_COMPLETE,performWindowComplete);
win.activate();
public function performWindowComplete(e:FlexEvent):void
{
win.stage.addChild(e.currentTarget as TestWindow);
}
and in the TestWindow ,I just add one textArea,when i open this new window,i click the textarea,it throws null object.i confused.
CREATION_COMPLETE event never fire because your component not added in display list/stage.First you need to add to display list.
opts = new NativeWindowInitOptions();
opts.resizable=false;
opts.maximizable=false;
win = new NativeWindow(opts);
win.alwaysInFront=true;
var newWindow:TestWindow=new TestWindow();
newWindow.addEventListener(FlexEvent.CREATION_COMPLETE,performWindowComplete);
win.addElement(newWindow); //Todo
win.activate(); //or Set visible = true

Dynamically Created LABEL Element not showing up in XUL application

I'm trying to dynamically create a set of labels in my XUL Runner application. I have an HBox like so:
<hbox class="upload-attachments"></hbox>
If I manually assign a label element to it like so:
<hbox class="upload-attachments"><label value="test" /></hbox>
It works fine. Also, when I query the object in Javascript I can access the test label.
When I try and create new label elements programmatically it fails. This is roughly what I am doing:
var attachments = view.query_first('.upload-attachments');
var label = view.ownerDocument.createElement('label');
label.value = "Some value."
attachments.appendChild(label);
var childCount = attachments.childNodes.length;
The query_first method is just a call to the Sly Query Selector engine and in other cases works fine. The childCount value is updating appropriately, and as I said, I can access and manipulate any labels I manually add to the hbox.
Thanks in advance,
Either append it with the attribute set, or set the property after inserting:
var label = view.ownerDocument.createElement('label');
attachments.appendChild(label);
label.value = "Some value."
-- or --
var label = view.ownerDocument.createElement('label');
label.setAttribute("value", "Some value.");
attachments.appendChild(label);
The reasoning being that, before the element was inserted, the property setters don't work.