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!
*Bump* in the naaaame of love...
Do the *bumpty* *bump*, a-do a-do the *bumpty* *bump*...
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}}"/>
</Style>
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.
Hi Alex,
I tried a subset of what was suggested:
<Style x:Key="recordPresenterStyle" TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<Setter Property="Background" Value="Blue"/>
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.
Regarding the theme,
You should place that style inside the Resources of the XamDataGrid itself, and nowhere up the element tree, as this style will not be picked up, because of the theme.
That worked! Now that I am modifying the actual template, what is the risk with future versions of the control?
Not much.
We are trying to keep the structure similar as much as possible, unless some big change is needed.
Thank you sir!