Windows store app user control event handling - windows-runtime

Assume my windows 8.1 store app consist of a page with a user control and a gridview.
User control has a listview inside.
Now what I want to do is when user change the selected item in the user control's
listview I want to populate the gridview on the page.
How do I do this?

Use MVVM pattern to establish relationships in your data
You could bind some property of the user control to a portion of your viewmodel which then updates whatever the gridview is bound to as well. I've had some success with using Prism but you could just use a simple class for the DataContext and INotifyPropertyChanged implemented.
Bind one control to selected item of another
It is also possible, if you are trying to display details on some sort of complex object, to bind to the SelectedItem of a different control. Such as if you were trying to use a listview as a list of names then display details
<ListView ItemsSource="{Binding Names}" x:Name="ListOfNames"></ListView>
<GridView ItemsSource="{Binding SelectedItem.Details, ElementName=ListOfNames}" ></GridView >

Related

How do I declare a reference to an ActiveX "ListView" Control in Access VBA?

I'm using Access 2003.
In "References" (Tools > References > Browse...), I've added in "Microsoft Windows Common Controls 6.0 (SP6)" (c:\windows\system32\mscomctl.ocx) and I've created/inserted an instance of the control "Microsoft ListView Control 6.0 (SP6)" on a Form and given the control the Name "MyListView".
I wanted to decorate MyListView with some custom methods so I've created a class ("DecoratedListView") which contains a member field ("lvw").
I want 'lvw' to point/reference MyListView, but I don't know what reference type to use in its declaration. Importantly, I also want to capture lvw's ColumnClick event.
I've tried:
Public WithEvents lvw As Object
Public WithEvents lvw As Control
Public WithEvents lvw As MSComctlLib.ListView.2
and none works when I
set lvw = MyForm.MyListView
Can anyone explain how I should create the reference (lvw) to the existing object (MyListView)?
Access can't really handle that sort of thing.
The OnClick should be available on your MyForm though, but you can't see it in the Event tab in properties. ActiveX Controls are too complicated for that. Instead, go into the code and choose MyListView in the combobox on the top left. You'll then find the extended ActiveX events in the combobox on the top right. One of them is ColumnClick.
Not sure what your full intentions are, but if you want to sort of mimic an isolated DecoratedListView class then create a special form that only includes a ListView control and use it as a subform for other forms. You can refer to the ListView from the parent Form as you would any other subform control object. Parent specific code can be run from the listview subform by checking the me.parent.name object which is basically the parent form. You can even call subform's listview events by changing the default Private Sub to Public Sub.
I can't comment yet, so I'll type it as an answer.
Did you look in View, Object Browser to see what methods and properties are available for that object? You should be able to write what you want using that information, assuming what you want is possible.

How to use the same ViewModel for different Pages (views)

I am searching for a way to use one ViewModel for two different Views (Pages). I know there is Multi-view support in Caliburn.Micro and I read a lot of it but I'm not sure if it is what I am looking for or how it works on Windows Phone.
Currently, I have one View ItemPage.xaml and one ViewModel ItemPageViewModel. I use this View/ViewModel to add a new Item and display an existing Item. Depending on the mode (add, show, ...) I need to show/hide or enable/disable some UI elements and display different AppBar buttons.
Instead of control these UI elements by binding to properties, I want to create two seperate Pages(Views) with the corrrect UI elements.
It would be nice to use the same ViewModel for both Pages to avoid repitive code. So is my use-case above possible with Caliburn.Micro for Windows Phone?

Items from data template

I am trying to access a webview item that's inside a flipview. This webview was declared inside a datatemplate of the flipview. Does anyone know how I can access the webview so that I can do things with it?
Move the contents of the DataTemplate into a UserControl and use that as your ItemTemplate. Then you can easily do whatever you want in that UserControl.
Ended up the best way was binding the web view item to a different property of the item, and then displaying what was in that property (NodeValue)

flex:how to get input values on creation complete

I have a datagrid,2 textboxes & a button .In the third textbox i want to display the total of one of the column in datagrid. The data in grid is populated on button click, depending upon the values in textbox. but until I get values on creation complete,I am not getting the total.If i do calculateTotal() on button click M not gettting total.what can i
Flex is an event driven framework. Use events by the controls and the IList used as data provider to determine the state of te ui and the data itself. So you can easily get notifications when new data is available, when data changed etc.

Flex Dynamic Component runtime Creation

I jus Want to know, how could be possible to create Dynamic Components in Flex run Time.
For eg: creating a combo box with change Handler Dynamically, text box Dynamically,
Now, the value of combo box and textbox should place in a VO Class and the VO class also to be created Dynamically,
user have to provide how many fields they need and wat are the components needed and according to tat Dynamic VO has to Create in run Time,
Hope This is clear,
kindly suggest me a Example, Thankxxx in Advance
To create Dynamic class is tricky.
As per your requirement you want some combo box with change Handler, text box, etc.
Once you know what component you have to display according to vo which is been created dynamically.
You can create One custom component which contains your all required component (i.e. combo box, , text box, etc. )
or
Can create different custom component. Selection is yours.
There should be one parameter/condition, which will decide which component should be displayed at run time. Like adding switch case or your own logic.
While creating combo box you can add addEventListner in actionscript to handle change even and can dispatch custom event or can perform your defined operation.
In the same way you can addEventlistner to your custom component (ex. – text box, checkbox, etc.).
There should be unique key for all if user want to create combo box unique key should be 1(sample/any dynamic value can be retrived from VO), text box unique key should be 2, etc…. it will help you while creating dynamic component.
Make sure while creating component you have to use concept of set and get method for passing parameter.
Create only required component by using proper Flex component life cycle.
Hope this may help you bit as rough understanding.. or can search for better approach..