I need to style a subset of columns returned by a stored procedure that are dynamic i.e. certain column names will always be returned and have the same name and certain columns will vary based on what parameters were passed to the stored procedure. The style I want to apply is the width as well as change the font size and make the column read only or editable.
<igWPF:XamDataGrid.FieldLayouts> <igWPF:FieldLayout> <igWPF:FieldLayout.Fields>
<!-- THESE ARE STATIC COLUMNS -->
<igWPF:Field Name="valvegroup_log_ID" Visibility="Collapsed" /> <igWPF:Field Name="timeseq" Visibility="Collapsed" /> <igWPF:Field Name="cst" Visibility="Collapsed" /> <igWPF:Field Name="std_datetimeseq" Visibility="Collapsed" />
<igWPF:Field Name="Time" Label="Time" Width="50" />
<!-- HOW DO I APPLY A STYLE TO A SUBSET OF COLUMN WHOS QUANTITY AND NAME WILL VARY BASED ON PARAMETERS
PASSED TO STORED PROC? -->
</igWPF:FieldLayout.Fields> </igWPF:FieldLayout> </igWPF:XamDataGrid.FieldLayouts>
Thanks
Hi Kris,
Thank you for your post. I have been looking into your requirement and the easiest way to achieve it is applying CellValuePresenter style using data triggers. Because the fact that the data triggers do not provide any ‘OR’ statement you will need to declare data trigger for each of the possible fields like e.g.:
<Style TargetType="igDP:CellValuePresenter">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="valvegroup_log_ID">
<Setter Property="Width" Value="200" />
<Setter Property="FontSize" Value="20"/>
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="timeseq">
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="cst">
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="std_datetimeseq">
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="Time">
</Style.Triggers>
</Style>
Let me know, if you need any further assistance on this matter.
Hello. Thanks for looking into this for me. I just need some more clarification. In your example all the data triggers have the Value property set to a column name. For some of the columns I will know the name like Time or std_datetimeseq like in your example above but for a subset of columns I will not know the name because those columns are dynamically generated by the stored proc based on parameters passed. I want to apply the same style to those columns. Would I do something like below where I leave the Value property out of the DataTrigger tag?
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" >