if you template out the header section for a column layout, how would you bind your control to the headerText property? is it possible? is it possible to bind you control to a property in the row class?
<Style x:Key="myChildBandHeaderStyle" TargetType="my:ChildBandCellControl"> <Setter Property="Margin" Value="100,10,0,10" /> <!--<Setter Property="Background" Value="Transparent" />--> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="my:ChildBandCellControl"> <StackPanel> <TextBlock Text="{Binding Value}" /> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>
Hi,
So, if you want to template the ColumnLayout header, there is a property called HeaderTemplate of type DataTemplate located on the ColumnLayout object.
ColumnLayout.HeaderTemplate
However, the DataContext is not of the Row's Data. This was an overisight and has been fixed for the first ServiceRelease.
-SteveZ
will not be able to validate until service release comes out.
any estimate on when that will be?
if you have a 3 level grid, such as (main row - child row - child of child row)
In the child row, is it possible to remove the expansion indicator from just the child band header (which i have template similar to above). i need to keep the indicator in the rows so that i can open the next level
So, this wasn't really anything that we considered when designing the control. However, it is possible, with the following code.
void DataGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
{
if (e.Row.RowType == RowType.DataRow)
foreach (ChildBand cb in e.Row.ChildBands)
cb.IsExpanded = true;
cb.Columns.ExpansionIndicatorColumn.Visibility = Visibility.Collapsed;
}
Hope this helps,
This does not work for me. i need to see the indicator col for the children in the rows. I Only Need to remove it in the Header. I have attached a pic for a better explanation.
i tried doing some other configuring in that event since your code gave me some idea, however i was pretty un successful, should you be able to set styles there? for instance i want to change the style of the footer of the indicator col to match the rest of the footers i have, i also was trying to style the fillerCol, which didnt work either
If TypeOf (e.Row.Data()) Is POAdjustment Then
e.Row.Columns.ExpansionIndicatorColumn.FooterStyle = LayoutRoot.Resources ("myGridChildFooter")
End If
If TypeOf (e.Row.Data()) Is POLineText Then
e.Row.Columns.FillerColumn.CellStyle = LayoutRoot.Resources("myCellChildEmpty") e.Row.Columns.ExpansionIndicatorColumn.FooterStyle = LayoutRoot.Resources("myGridChildFooter") End If
Sure. For the first SR, I've added the ability to set the Style for a Particular ExpansionIndicatorCell. You can currently use this code, and once the SR is released, the style will be applied.
cb.Cells[cb.Columns.ExpansionIndicatorColumn].Style = Application.Current.Resources["EIStyle"] as Style;
this does not see to work, i guess ill test it after the SR
and insight on the other styling issues
HI,
The other style properties off of those special columns will work in the SR. And for FillerColumn, we've actually added a FillerColumnSettings object, to set the Styles for those properties.
if you have tested it can you sent your Style over. i have a few i have tried and i know they work when applied in the typical Xaml fashion