This is a migrated thread and some comments may be shown as answers.

Refresh row style in Owner window

5 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 2
Charles asked on 06 Nov 2009, 09:09 PM
Using RadGridView Q3 release.

I have a RadGridView in my main window. There is a datatrigger implemented to change the row's color to red when an "IsModified" property is set. This works well when the grid loads, but I have not been able to accomplish this from a window owned by the main window.

I have tried the following:
 ((Owner as MainPricingWindow).grdSearchResults.SelectedItem 
                
as SecurityVO).IsModified = true;

 

 

 

That sets the property appropriately, but doesn't change the grid row style in the owner window. The ItemsSource of the grid is an ObservableCollection and the object (SecurityVO) implements INotifyPropertyChanged. The IsModified property calls raises the PropertyChanged event. All this seems to happen normally when the grid is loaded with some rows that have IsModified set. It will not change the row when the property is modified from a child window.

One additional thing I should add. The style fo the grid row in question is set via a DataTrigger. So the foreground color of the row is set if a particular property of the SecurityVO is set to true.
 
I guess I'm missing something. Any help would be appreciated.

Thanks.

 

5 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 12 Nov 2009, 11:32 AM
Hello Charles,

There is actually a problem with the Foreground property only. Internally it is set explicitly on cells and that is why the triggers are not working. We are currently thinking of removing this limitation but it is still unknown when we will be able to do so.

Is is possible to use another property like background for the time being? 


Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Milan
Telerik team
answered on 12 Nov 2009, 01:47 PM
Hello Charles,

Just wanted to inform you that we have fixed the Foreground binding problem. The fix will be available this Friday with our Latest Internal Build.


Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Charles
Top achievements
Rank 2
answered on 16 Nov 2009, 05:03 PM
I just downloaded and installed the latest internal build, but the problem still seems to be there. I cannot seem to set the foreground of a GridViewRow from a child window. I am using a DataTrigger on the GridView. Here is the XAML definition of the gridview:

                        <tgrid:RadGridView AutoGenerateColumns="False" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" 
                                           Name="grdSearchResults" ItemsSource="{Binding}" CanUserInsertRows="False" 
                                           CanUserReorderColumns="False" CanUserSortColumns="False" ShowGroupPanel="False"   
                                           IsReadOnly="True" MouseDoubleClick="Grid_MouseDoubleClick">  
                            <tgrid:RadGridView.Resources> 
                                <Style TargetType="{x:Type teletheme:GridViewRow}">  
                                    <Style.Triggers> 
                                        <DataTrigger Binding="{Binding Path=IsModified}" Value="True">  
                                            <DataTrigger.Setters> 
                                                <Setter Property="Foreground" Value="Red"/>  
                                                <!--<Setter Property="Background" Value="LightBlue"/>--> 
                                            </DataTrigger.Setters> 
                                        </DataTrigger> 
                                    </Style.Triggers> 
                                </Style> 
                            </tgrid:RadGridView.Resources> 
                            <tgrid:RadGridView.Columns> 
                                <tgrid:GridViewDataColumn Header="Portfolio" DataMemberBinding="{Binding PortName}" Width="1.45*"/>  
                                <tgrid:GridViewDataColumn Header="Ticker" DataMemberBinding="{Binding Ticker}" Width="1*"/>  
                                <tgrid:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Description}" Width="3*"/>  
                                <tgrid:GridViewDataColumn Header="Security ID" DataMemberBinding="{Binding SecurityID}" Width="1.5*"/>  
                                <tgrid:GridViewDataColumn Header="Price" DataMemberBinding="{Binding Price, Converter={StaticResource DecConverter}}" 
                                                          Width="1*">  
                                </tgrid:GridViewDataColumn> 
                                <tgrid:GridViewDataColumn Header="Price Source" DataMemberBinding="{Binding PriceSourceCode}" Width="1.6*"/>  
                            </tgrid:RadGridView.Columns> 
                        </tgrid:RadGridView> 

As in an earlier post, I attempt to fire the data trigger from a window that is external and is owned by the window that has the grid on it. I use code like this:

            // Update the grid to set the IsModified of the appropriate security  
            ((Owner as MainPricingWindow).grdSearchResults.SelectedItem as SecurityVO).IsModified = true;  
            SecurityVO vo = ((Owner as MainPricingWindow).grdSearchResults.SelectedItem as SecurityVO); 

When I close the child window and inspect the grid in the main window, the background color is unchanged. If I use the foreground color, it does work as expected.

0
Accepted
Milan
Telerik team
answered on 19 Nov 2009, 10:49 AM
Hi Charles,

I have tried a similar scenario and it all worked correctly with ourbinaries from 11/16. I am sending you my test application - it is pretty much the same as yours, I just use another property for the DataTrigger.


Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Charles
Top achievements
Rank 2
answered on 19 Nov 2009, 02:09 PM
Thanks for the reply. I had downloaded the 1109 build, thinking that was the one with the fix. I had downloaded it on the Friday after telerik posted a response mentioning that it would be in the latest internal build that Friday. So, it was just a timing issue - I have downloaded the 1116 build and all works fine.

Just a tip, not sure if this has already been posted...

Once I replaced the binaries, I was pleasantly surprised to see that the new version had replaced the old in my "References" folder in my project. However, when I tried to run the application, I was getting XAML parsing errors that pointed to versioning differences. To solve this issue, I put modified the XAML and then took out the modification (anything will do, an extra character, a carriage return) and saved. That, I suppose, made a difference because I was able to run the application without any errors after that.
Tags
GridView
Asked by
Charles
Top achievements
Rank 2
Answers by
Milan
Telerik team
Charles
Top achievements
Rank 2
Share this question
or