My XamDataGrid has a child table that is automatially given a header identifying the entire table. The data source is a DataSet and I use the following XAML to change the title of the header:
<
igDP:Field Name="FK_Templates_BetConfiguration" Label="Bet Configuration:"/>
That works just fine. I have been unable to find a way to style the child table's label so that it doesn't affect the child table's column headers (or doesn't require me to re-write ExpandableFieldRecordPresenter). So, the natural question is how do I do this?
Thanks!
Hi Alex,
I tried a subset of what was suggested:
<Style x:Key="recordPresenterStyle" TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<Setter Property="Background" Value="Blue"/>
</Style>
The result was that eveyrthing had a blue background except the column headers and table headers (the second of which I am targeting). Let's say I had the following table:
Header Alpha
Col A Col B Col C Col D
Value 1 Value 2 Value 3 Value 4
What I want to style is "Header Alpha" exclusively. BTW, I am using the Office2k7Blue theme in case that has any impact.
Thanks.
Thanks for clearing that out. You are trying to restyle the header of the expandable field record presenter and not the label presenter. In this scenario, I would go with a converter for the ExpandableFieldRecordPresenter. Here is a very simple way to achieve this:
<local:MyConverter x:Key="conv"/>
<Style TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<Setter Property="Background" Value="{Binding Path=Index, Converter={StaticResource conv}}"/>
class MyConverter : IValueConverter
{
public object Convert(...)
if ((int)value == 0)
return Brushes.Red;
else
return Brushes.Blue;
}
...
Here I am using the Index of the ExpandableFieldRecord so that I can identify it. You can, of course, bind to anything you want as long as it is identical for each record.
That didn't work, but I'll assume it was a problem in the way I described what I was after. I'll paraphrase. Every expandable table in my XamDataGrid has a header (it exists right above the column listing of the table). I want to style that header. My attempts to do so have failed because whenever I style the table header I end up styling the column header as well (or the alternative is nothing gets styled at all). So my question is, how do I style the table header without affecting anything else?
Ouch, Ouch. Here is a sample code snippet that will do the trick:
<Style TargetType="{x:Type igDP:LabelPresenter}">
<Setter Property="Background" Value="red"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=HasChildData, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:DataRecordPresenter}}}" Value="True" >
</DataTrigger>
</Style.Triggers>
Hope this helps.
Do the *bumpty* *bump*, a-do a-do the *bumpty* *bump*...