Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
52
Problem with CellValuePresenter Template Foreground in combination with DataRecordCellArea
posted

Hi, I 'am having a bit of a trouble with "cellvaluepresenter"  foreground color. I have a DataRecordCellArea for Alternate background, i use it for opacity background, and it works fine. Becouse my background of USerControl  is black  and xamDatagrid is transparent  I want to  cellvalue presenter to have a white foreground  and when mouse over to turn black.  It works fine for simple case, but when I use Template for CellValue Presenter, becouse cells have a different fonts and propertis , it dont work. Here is my sample code:

 

  <Style TargetType="{x:Type igDP:DataRecordCellArea}">
                                                      
                                                        <Setter Property="BackgroundAlternate">
                                                            <Setter.Value>
                                                                <SolidColorBrush Opacity="0.3"  x:Name="animatedBrush" Color="LightGray" />
                                                            </Setter.Value>
                                                        </Setter>

                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
                                                                <Setter Property="TextBlock.Foreground" Value="Black"/>
                                                            </DataTrigger>

                                                            <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="False">
                                                                <Setter Property="TextBlock.Foreground" Value="White"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>

 

 


 <Style x:Key="NazivCell" TargetType="{x:Type igDP:CellValuePresenter}">
                                                                       <Setter Property="Control.Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                                                                    <StackPanel Orientation="Horizontal">
                                                                        <Label  Style="{TemplateBinding ForegroundStyle}"   Content="{Binding Path=DataItem.Naziv}" TextBlock.FontFamily="Calibri" TextBlock.FontSize="14" TextBlock.FontWeight="Bold"    TextBlock.TextAlignment="Left"/>
                                                                                                                                                 
                                                                    </StackPanel>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>

                                                    </Style>

 

I tried everithing , it works without a template in cellvalue presenter.

 

 

  • 138253
    Offline posted

    Hello Antonio12345,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

     

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

  • 138253
    Offline posted

    Hello Antonio12345,

    Thank you for your post. I have been looking through it and I assume you want to change the style of your CellValuePresenter. The suggested way of doing this is to use the original template which we provide along with our product just for such purposes. You can find it in the DefaultStyles folder which is installed by default here: C:\Program Files (x86)\Infragistics\NetAdvantage 2010.3\WPF\DefaultStyles  and in it you can use:  \DataPresenter\DataPresenterGeneric_Express.xaml file to copy what you need. You should also explicitly set the CellValuePresenterStyle Property, so that you can apply the custom style you have created or leave the style without a Key so that it applies to all Fields. Please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. We believe that the other community members could benefit from this thread as well.

    Feel free to write me if you need further assistance.