GridView Control with different child categories that have no relationship to each other - xaml

I may be missing something here so I apologise if this question may come across as obvious.
In a XAML WinRT app, I can have a GridView control that I can throw a collection of stuff at, and then using DataTemplates etc I can render that stuff on screen.
How can I take this a step further and have a single “master” GridView control which contains several sections which get their data from different places and exist within the app as different collections of stuff?
For example, take the built in Games app. Here we have different sections – Spotlight, Friends, Game Activity etc which are all very different from each other, have different data and are displayed in different ways but they all exist within the same GridView control.
How can this be done?
I do hope this makes sense
Kris

If I understand your requirement correctly, you want to have a group of groups, and display each of the child groups using different templates.
The way I did it was to derive all the child items from a common base class (or you could build a group of groups of Objects, I suppose). Then we used the DataTemplateSelector to pick the appropriate template for each item in the master GridView.
We had to go a step or two further than that in practice, but that's the theory behind how I achieved a similar goal.

Related

Custom odoo module - how to make a table

I am creating a custom module with additional part numbers on a separate tab in the products screen. I have built the module, but am having trouble figuring out how to display the information so it matches the layout in the attached image. I have tried tree view but have not been able to get the fields on the same line. Can this only be accomplished through css or is there a table view that I am not aware of?
I also need to make sure that all of the information in row 1 stays tethered together for additional forms, etc. My plan is to make the field names for each row end with a different number (i.e. x_mfrname1,x_mfrpn1,x_mfrname2,x_mfrpn2, etc.). Can somebody please just tell me if I am on the right track. This is the initial Odoo setup for a client of mine and I don't want them to come back to me down the line and find out I forgot something. I have been scouring the internet and reading a few books but I am not completely confident.
Here is a link to a layout of what I am talking about:
MFG Part Number Tab
Thanks!
class sub_part_details(models.Model)
_name='sub.part.detail'
primary_pn=fields.Boolean('Primary P/N')
obsolete=fields.Boolean('Obsolete')
pn=fields.Char('P/N')
desc=fields.Char('Description')
upgrade=fields.Char('Upgrade')
part_detail_id=fields.Many2one('part.details')
class part_details(models.Model)
_name='part.details'
cat=fields.Char('CAT')
sub_ass=fields.Char('Subassembly')
main_ass=fields.Char('Main Assembly')
notes=fields.Text('Notes')
sub_details_ids=fields.One2Many(''sub.part.detail','part_detail_id')
It might be helpful

SiteFinity 7.1 custom content items and grouping

We have a list of faculty and units for a SiteFinity 7.1 site. We have these as custom content items in the site, because we are programming against them and building a few widgets around them.
However, we also have news about these faculty and units, and we'd like to use the existing news items in SiteFinity.
How do we easily tie faculty and units (custom content items) to news items (another content item baked into SiteFinity)? I wasn't sure if we create classifications that list faculty and units, and use these as the grouping mechanism? Or is there an easy way to tie two content items together? 
It kind of depends on how you're going to (or how you want to) display the data at the end. Here are a couple of different ways to achieve what you're after.
You're planning on using the stock News widget to display the content.
If this is true, using a custom taxonomy would be pretty easy in this case. Here's a video that outlines this method.
You're planning on displaying the news items in close proximity to one of the custom content types you've created.
In this case, adding a related data field to the custom type would allow you use related content items with widget templates.

Core Data and bindings - binding checkbox to result of many-to-many relationship

Core Data model
I have a many-to-many relationship between two of the principal entities; call them Item and Tag. There will be a large number of Documents. Each may have 0 to an arbitrary number of tags.
Each Item entity relevantly has an attribute called name, and a to-many relationship to Tag called tags. Each Tag entity relevantly has an attribute called name, and a to-many relationship to Item called items.
To display them, within the same window, I have: (i) an NSTableView (itemTableView), fed by an NSArrayController (itemArrayController), showing all Items; and (ii) an NSTableView (tagTableView), fed by a different NSArrayController (tagArrayController) showing all Lists.
tagTableView
In the tagTableView, the Table View is bound to tagArrayController, with controllerKey arrangedObjects.
There is only a single table column. The textfield in it is bound to Table Cell View, to model key path objectValue.name. That works so far; it displays all of the lists as expected, and sorts properly when I add a sort descriptor.
Everything has been set up using interface builder in Xcode.
The problem
I have added a checkbox into the tagTableView, in the same table column as the textfield. I am trying to implement two things:
The checkbox should be checked if the user has previously associated the Item with the relevant Tag. If not, the checkbox should be unchecked.
If the user checks an unchecked checkbox, I want to establish a relationship between the two; if the user unchecked a checked checkbox, I want to break that relationship.
The underlying behavior pattern is that the user will not necessarily have control over the tags and may not be able to create them. They are to choose from existing tags, and therefore should be able to see which ones exist, and be able to check/uncheck those that apply.
However, I can't see how to implement this.
Part solutions so far
I can see a possible way to do at least the first task programmatically, roughly along these lines:
Monitor tableViewSelectionDidChange for itemTableView
For a change, update the data source for tagTableView manually, and work out checkbox state by checking them for those Tags which relate to the Item entity that has just been selected, and otherwise unchecking them
However, this looks likely to add complexity, and ideally I would like to do this with bindings if possible.
I have reviewed the Apple Core Data and Bindings references, all the Cocoa books I have, stack overflow and I've also done extensive googling. I have found lots of similar questions (e.g. http://lists.apple.com/archives/cocoa-dev/2011/Mar/msg00164.html) but no answers.
I've also found a way that might work programmatically, but which seems to be like my idea above, at the expense of being able to use bindings (e.g. http://www.raywenderlich.com/14742/core-data-on-ios-5-tutorial-how-to-work-with-relations-and-predicates)
The only relevant question on this site -- Core-Data Check Box Cell with many-to-many data -- is not answered to a level that I can make use of.
It would seem to me that this should be a prime candidate for bindings. I should be able to ask the itemArrayController what Tags (if any) have a relation to its selected item, and then set the checkbox to ticked if it matches the relevant Tag, and unset it if it doesn't. I would expect I should be able to do this within the bindings for the checkbox itself, in interface builder. But I can't work out what model key path or binding to use, or what to set the cocoa bindings for the checkbox to. Am I missing something obvious? Thanks

SDK2: drag and drop between two grids

Using SDK2, I've got two grids that are sorted by rank, so you can re-rank by dragging and dropping in each grid.
I would also like to drag and drop between the two grids-- imagine two team backlogs and you want to take a ranked story from one team and rank it in another team's backlog.
This seems like it would be common so is there a good example of how to do this with a Rally Grid?
I'm starting to read the following:
http://docs.sencha.com/extjs/4.2.1/#!/guide/drag_and_drop
But there always seem to be a few gotcha's, and for example I'm not sure how to not break the current drag drop within the grid.
SDK 2.0rc1 is built on Ext 4.1.1a- the drag and drop functionality should be similar though. You should be able to do this in an app as long as both the grids are in the same app. This is a limitation due to the fact that apps run in an iframe in Rally and you can't drag and drop across the iframe boundary.
All you should need to do is pass enableRanking true at construction of your grid. You also will probably need to include Rank in your fetch.

Add Control after Items in GridView Group

I'm currently developing a Windows 8 Store app that uses a Grouped GridView in the HubPage showing Highlights for some Categories. So far, when clicking the Header you see More Highlights for this Category.
Now i want to add a control at the end of every Group leading the User to the "non-highlight" Category site, where just all the Items of this category are displayed.
Is there an easy and elegant way to do this - propably with a Template is suppose.
( i think the latest Bing-News-App has a similar feature )
Thanks in advance for every help.
There are a couple of ways you can do this.
You can add an arbitrary object to the end of your group, then use a DataTemplateSelector to style it.
You can create your own VariableSizedWrapGrid with the control added to the end in the constructor (slash "Arrange"). You can then add an arbitrary click handler as a dependency property and only show the button if the click handler is set, so you can reuse this on other pages, etc.
You can change the GroupStyle to include something similar at the end of the group, but it likely won't animate with the other items in the group (if that's important to you).
The easiest one to do is probably the first one. If your group is a list of SampleItems then make a subclass of the SampleItem class called something similar to TerminalSampleItem. Create a template for it (like you've made other data templates). Make an ItemTemplateSelector that has two properties, NonTerminalDataTemplate and TerminalDataTemplate (assuming you only have two data templates). Have the SelectTemplateOverride function check for (item is TerminalSampleItem);