GridView items hidden when HeaderTemplate specified - windows-runtime

I have a grid view like so:
<GridView ItemsSource="{Binding Source={StaticResource GroupedMatches}}"
SelectionMode="None"
ItemClick="OnItemClicked"
IsItemClickEnabled="True"
Grid.Row="4"
Grid.Column="1">
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</GridView.GroupStyle>
</GridView>
GroupedMatches is a CollectionViewSource in the page:
<CollectionViewSource x:Name="GroupedMatches"
Source="{Binding Matches}"
IsSourceGrouped="True"
ItemsPath="Matches" />
Its backing view model is a class with Name and Matches properties where Matches is an IEnumerable.
When the above is rendered with three items spanning two groups, only two of the items are rendered. If I remove the GridView.GroupStyle then all three items are rendered as expected. Does anyone know what might be causing the item to be culled when headers are present?
Edit: Following up I have discovered that the second group (in which items are not appearing as expected) seems to have its size match the first group. So if the first group has two items in it the second group will show two items. If the first group has three items the first group will show three, and so on. For now I have opted to change the layout to more closely reflect the default grid layout mentioned by Filip, but have not been able to determine why the two groups' sizes are linked.

Hi Alex (I believe we'd met before). In addition to what Jim said (does each of your Matches represent an object with a Name and another nested Matches property?) you might run into an issue where if you don't specify the GroupStyle.Panel - you will get a default StackPanel which might get some items in your grouped collection clipped. When you create a default "Grid App (XAML)"-template based application - you get the following definition of the group panel:
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid
Orientation="Vertical"
Margin="0,0,80,0" />
</ItemsPanelTemplate>
</GroupStyle.Panel>
Now if you comment that out - your groups will change from this
to this

Related

ActionScript 3 mx:HorizontalList set columns per row

I have a Flex HorizontalList like so:
<mx:HorizontalList id="myList" width="1462" height="878" columnCount="3" rowHeight="475" columnWidth="350" dataProvider="{floorPlans}" itemRenderer="FloorplanItems">
</mx:HorizontalList>
I am trying to set 3 columns per a row, I thought columnCount would do it, but either its not working and or is not doing what I thought it would be doing.
How can I set 3 columns per a row?
mx:HorizontalList is meant to list items in one row. The columnCount property is used to define the number of columns appearing without a need to scroll.
I suggest that you use Spark List "s:List" instead and define tile layout inside it in addition to specifying item renderer width that fits your needs.
<s:List id="addressesList" width="100%" height="100%" itemRenderer="FloorplanItems">
<s:layout>
<s:TileLayout id="tileLayout" horizontalAlign="justify" columnAlign="justifyUsingWidth"/>
</s:layout>
</s:List>
Hope this helps,
goodluck.

System.Exception {System.ArgumentException} Value does not fall within the expected range

I'm getting this exception whenever i try to access m list picker control in my app.
+ this {App_name.App} App_name.App
+ sender {App_name.App} object {App_name.App}
- e {System.Windows.ApplicationUnhandledExceptionEventArgs} System.Windows.ApplicationUnhandledExceptionEventArgs
+ base {System.Windows.ApplicationUnhandledExceptionEventArgs} System.EventArgs {System.Windows.ApplicationUnhandledExceptionEventArgs}
+ ExceptionObject {System.ArgumentException: Value does not fall within the expected range.} System.Exception {System.ArgumentException}
Handled false bool
+ Non-Public members
Code for my list picker is
<ListBox Margin="0,417,0,0">
<ListBoxItem>
<toolkit:ListPicker Name="LearnerFileChooser" Width="431" >
<toolkit:ListPickerItem Content="A" />
<toolkit:ListPickerItem Content="B" />
<toolkit:ListPickerItem Content="C" />
<toolkit:ListPickerItem Content="E" />
<toolkit:ListPickerItem Content="F" />
<toolkit:ListPickerItem Content="G" />
<toolkit:ListPickerItem Content="H" />
</toolkit:ListPicker>
</ListBoxItem>
If i reduce the no. of items to 4 then it works properly but it crashes on more then 4 items.
I'm trying to create a list of alphabets from which user can choose.
It's a known issue.
You must bind the items to be able to use more than 5.
Explanation on Codeplex:
ListPicker as an ItemsControl, gets its Items property set to a list
of ListPickerItems in your example. ListPickerItems are UIElements,
and the ListPicker renders them in its presenter. When there are 5 or
less items, the expanded mode opens on the current page, and you can
see all the items in the presenter.
But when 6 or more items are present, opening the list picker goes to
full mode which opens a new page. This new page has a listbox, which
gets its items property set to the listpicker's items. This is where
it breaks. By setting the listbox's items to the listpicker's items
(in this case a list of listpickeritems), the listbox will put those
UIElements into its view. Now a single listboxitem is included in two
places on the visual tree.
Because of this issue, ListPicker only supports databinding and
templating. DO NOT set the ListPicker's items to specific UIElements.

WP8 How to animate a ListBox with Blend

I wonder how do an animation with listbox so that the first item comes first than the second, then the third, and so when the listbox is loading as in the example below.
You can accomplish this with the TurnstileFeatherEffect from the Windows Phone Toolkit. Here is a complete sample page.
You accomplish this by adding the following transitions to your page
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
And then state in which order you want them to fly in. You do this by setting the FeatheringIndex on each item that you want animated. If you have a ListBox that you want to animate the items, you only need to set the index on the ListBox itself and not on the DataTemplate.
<ListBox toolkit:TurnstileFeatherEffect.FeatheringIndex="0">
</ListBox>

Flex 4 Programatically Add Item to <s:List>

How can I add an item to a Flex 4 <s:List> component that has an item renderer? Here is the code sample of the list that I would like to append data onto:
<s:List contentBackgroundAlpha="0" borderVisible="false" id="reviews"
itemRenderer="renderers.ReviewRenderer" dataProvider="{data}"
top="10" minHeight="1">
<s:layout>
<s:VerticalLayout useVirtualLayout="false" requestedMinRowCount="1" gap="35"/>
</s:layout>
</s:List>
The data variable that the <s:List> is bound to will have the exact same properties as the object that I would like to append on the list.
Please let me know if I can provide any more details.
Thank you for your time.
How can I add an item to a Flex 4 component that has an item
renderer?
You wouldn't. You would add an item to the List's dataProvider. Then the list decides how to display the elements in the dataProvider based on other factors, such as the layout and the itemRenderer. For visual purposes, one way to view the list is as a collection of itemRenderers. There is one itemRenderer for each displayed item in the list.
In most cases there will be fewer items displayed in the list than there are items in the dataProvider. itemRenderers are re-used as the list is scrolled through, and the data property on the itemRenderer instance is modified.
So, if you want to know how to add an item to a List's dataProvider, it depends on the dataProvider type. Assuming an ArrayCollection, you should do something like this:
this.data.addItem(myNewItem);

How to create totals row for grouped columns

If have an rdlc-report with grouped columns within a tablix (table). I want to add a footer row that spans all dynamically created columns and shows a total for all columns together.
How can I tell to a cell that it should span all created columns created by the group?
|-------|-------|-------|
| col 1 | col 2 | col 3 |
|-------|-------|-------|
| Column-Group Total |
|-----------------------|
Please note, calculating the total is not my problem. I'm only searching for a way to tell report viewer to merge cells that are created automatically through a column-group for a specific row.
Update
Sadly, up to now, I have not found a solution to this. Moreover the same question I also have encountered in a report where I had to add totals of a row-group in a merged column.
|------|-------|
|row 1 | |
|------| Row- |
|row 2 | Group |
|------| Total |
|row 3 | |
|------|-------|
I find this a quite common way of showing totals. Is this not possible in either way or am I missing something obvious?
Update2
Here a screenshot of what I mean:
In the middle there is a group. This creates at runtime n columns. What I want to do is the "spanning category total" to span all dynamically created columns. This means, that the columspan of the cell is n. There is only one cell and in this cell I will show the total of all categories. It's quasi the same as report viewer creates automatically at the top of the group.
Don't know if you've found an answer to this, yet, but if not...
Usually, totals are expected in the last column for data grouped in columns and the last row for data grouped in rows...
However, depending on the scope, and the level of grouping you have, you might be able to achieve what you want by embedding your tablix into an outer tablix, and then adding a row to the outer tablix that sums the data there.
I have used multiple data regions within rectangles and lists to manipulate all kinds of layouts. You just have to play around with scopes, and possibly adjust your output data (sums/averages by groups in stored procedure) if those scopes just aren't cooperating. Let me know if it solves your problem.
As I know, rdlc are report files you edit on Report Wizard or visual studio as opposed as rdl that are report files being developed on BIDS.
I don't know if this will work on rdlc files because I only use BIDS, but I think its worth the try:
on the row groups tab (botton left) right click on your group and
select add total -> after, it will add a total row.
temporarily copy the sum cell (the total) to some other place on the
report (because the next step would erase it if you dont)
using SHIFT, select cell by cell on the row you want to merge (don't
select the row itself)
right click it and select merge cells
paste the sum cell you copied away on step 2
Result (I hope you can see):
EDIT:
answering your question, yes I'm sure it can be done because I did it several times and also you saw on the print screen.
I'm pasting the XML for my row, I think the secret is on the <ColSpan>8</ColSpan> tag. I do have 8 columns on my report.
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="textbox18">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!myField.Value)</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>9pt</FontSize>
<Format>'$'#,0.00;('$'#,0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox16</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>White</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<ColSpan>8</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
</TablixCells>
</TablixRow>
Since it looks like you have a dynamic column group, you will probably put into the columns:
Fields!ColHeading.Value |Total
Fields!DataValue.Value | =SUM(Fields!DataValue.Value)
If you prefer the graphical interface, right click on the total's value field and click on Expression. In the popup, expand the Common Functions and click on Aggregate and in the Item window, double click on Sum. Type in or click the data field and you will get something like this:.
Hit Ok, and you are good to go!