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

Problems finding NewRowStyle to retemplate

7 Answers 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 17 Jan 2012, 06:42 PM
I am trying to change the insert icon on the RowIndicator to a different image.  I am new to re-templating, but I did figure out how to use Blend to create a template of RowStyle.  I was able to locate where the insert image was (PART_IndicatorPresenter) and change the EditIndicator it to something else.  Over 200 lines of XAML in the template to just end up changing 4 lines of Path Data seems strange, but I was able to see a change on my grid.

Unfortunately that isn't the change that I was looking for.  I am now getting my new image on MOST of the rows.  It doesn't make much sense as before the image changes those rows were not displaying anything on the Row Indicator.  Even stranger to me is that when inserting a new row, I still see the old image.  I am pretty sure I only want to change the image on the new row.  So instead of re-templating the RowStyle, I believe I need to work with the NewRowStyle.

When I use blend to create a template from an object, I only have the option to choose RowStyle under Additional Templates.  When I try to Edit Additional Styles on the object I have an option for the NewRowStyle, but once I select it I can only create empty.  What am I missing?

-Randy

7 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 17 Jan 2012, 07:33 PM
Hello Randy,

 

RadGridView has a part named GridViewNewRow - you should modify its template and change it own indicator in a way similar to the one you have already used for a plain GridViewRow.
Unfortunately we have some issues related to the Blend support for RadGridView/Silverlight. I'll recommend you to use the following approach:


1.Find in Assets library a single GridViewNewRow.
2.Drag it onto the Artboard, right click on it and choose the option Edit template -> Edit a copy.


You may use the same approach for any other GridView part.

Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Randy
Top achievements
Rank 1
answered on 17 Jan 2012, 07:54 PM
Thank you for the quick answer!  I am almost there.

After making the changes to the Edit Indicator, I still have two issues that need to be resolved.

#1.  My new icon is displayed on top of the existing edit icon when the Add New Row is displayed, but not in edit mode.  I would like to only display the original edit icon here.  I am a bit confused by having both images as I did remove the old one when I re-templated the GridViewNewRow. 

#2.  When editing the row, sometimes I get two images (my new one as well as the original edit one).  
0
Vanya Pavlova
Telerik team
answered on 17 Jan 2012, 10:24 PM
Hi Randy,

 

If you want to permanently show the default icon of GridViewNewRow just delete the edit icon and the edit state associated with it.



All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Randy
Top achievements
Rank 1
answered on 25 Jan 2012, 01:32 AM
Part of my problem was that I was changing the visibility of the image.  Once I set that back to the default, I was able to use the new style and have it work as expected.

However, I have a different problem now.  I was able to replace the image in edit mode for new records, but I also need to do the same for existing records.  When I try to style either the GridViewNewRow or the GridViewRow individually, it works fine.  However when I try to do both I run into problems.  First problem was that they generate some of the same keys.  I got around that by re-templating both controls inside of Expression Blend.  Unfortunately once you try to run the application with both styles applied, the control does not act as expected.  Even when I just use the control templates without any changes, they still don't work right.  It is a bit hard to explain, but I will try.  Once you add a new row and leave that row, the add new row control ends up looking like a new row was just inserted.

Hopefully there is an proper way to do this that I am just overlooking?
0
Vanya Pavlova
Telerik team
answered on 30 Jan 2012, 08:55 AM
Hello Randy,

 
Please accept my apology for the delayed reply!
GridViewNewRow provides different indicators either in an edit mode or in non-edit mode. They are completely separeted. Indeed they share common resources, however there should be no problem to retemplate these. If you need sample project I will be glad to prepare small demo which illustrates how this can be achieved. 



Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Randy
Top achievements
Rank 1
answered on 30 Jan 2012, 08:50 PM
I think I have the GridViewNewRow working as expected.  I am trying to change the image with the little "I" in it.  That works fine.  However I also want to change the same little "I" image on an existing row that is in edit mode.  I am assuming that this doesn't involve GridViewNewRow and instead involves GridViewRow instead.

My problem is that when I try to re-template BOTH of these items, the functionality changes.  This happens even before I change one line of XAML in the new templates.

So quesiton #1, am I looking in the right place with GridViewRow to change the image for the edit mode?

And #2, are there issues with retemplating both elements or am I just doing something wrong?

Thanks,

Randy
0
Vanya Pavlova
Telerik team
answered on 01 Feb 2012, 01:50 PM
Hello Randy,

 

GridViewRow and GridViewNewRow use an element named EditIndicator which appears when you enter edit mode. In both templates they use common Path elements and Brush resources.
For simplicity what you may do is to separate these styles in separate ResourceDictionaries and to keep it independent:

<Grid x:Name="EditIndicator" HorizontalAlignment="Center" Height="10" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                <Path Data="M14,9 L15,9 15,10 14,10 z M1,9 L2,9 2,10 1,10 z M15,8 L16,8 16,9 15,9 z M0,8 L1,8 1,9 0,9 z M15,1 L16,1 16,2 15,2 z M0,1 L1,1 1,2 0,2 z M14,0 L15,0 15,1 14,1 z M1,0 L2,0 2,1 1,1 z" Fill="{StaticResource GridView_EditIndicatorBackground1}" Stretch="Fill"/>
                                <Path Data="M0.99999994,6.9999995 L2,6.9999995 3,6.9999995 4,6.9999995 5,6.9999995 6,6.9999995 7,6.9999995 8,6.9999995 9,6.9999995 10,6.9999995 11,6.9999995 12,6.9999995 13,6.9999995 13,7.9999995 12,7.9999995 11,7.9999995 10,7.9999995 9,7.9999995 8,7.9999995 7,7.9999995 6,7.9999995 5,7.9999995 4,7.9999995 3,7.9999995 2,7.9999995 0.99999994,7.9999995 z M13,0.99999994 L14,0.99999994 14,1.9999999 14,2.9999995 14,3.9999995 14,4.9999995 14,5.9999995 14,6.9999995 13,6.9999995 13,5.9999995 13,4.9999995 13,3.9999995 13,2.9999995 13,1.9999999 z M0,0.99999994 L0.99999994,0.99999994 0.99999994,1.9999999 0.99999994,2.9999995 0.99999994,3.9999995 0.99999994,4.9999995 0.99999994,5.9999995 0.99999994,6.9999995 0,6.9999995 0,5.9999995 0,4.9999995 0,3.9999995 0,2.9999995 0,1.9999999 z M11,0 L12,0 13,0 13,0.99999994 12,0.99999994 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 4,0.99999994 3,0.99999994 2,0.99999994 0.99999994,0.99999994 0.99999994,2.3841858E-07 2,2.3841858E-07 3,2.3841858E-07 4,2.3841858E-07 5,2.3841858E-07 6,2.3841858E-07 7,2.3841858E-07 8,2.3841858E-07 9,2.3841858E-07 10,2.3841858E-07 z" Fill="{StaticResource GridView_EditIndicatorBackground2}" Margin="1" Stretch="Fill"/>
                                <Path Data="M2,9 L3,9 4,9 5,9 6,9 7,9 8,9 9,9 10,9 11,9 12,9 13,9 14,9 14,10 13,10 12,10 11,10 10,10 9,10 8,10 7,10 6,10 5,10 4,10 3,10 2,10 z M14,8 L15,8 15,9 14,9 z M1,8 L2,8 2,9 1,9 z M15,2 L16,2 16,3 16,4 16,5 16,6 16,7 16,8 15,8 15,7 15,6 15,5 15,4 15,3 z M3,2 L4,2 5,2 6,2 6,3 5,3 5,4 5,5 5,6 5,7 6,7 6,8 5,8 4,8 3,8 3,7 4,7 4,6 4,5 4,4 4,3 3,3 z M0,2 L1,2 1,3 1,4 1,5 1,6 1,7 1,8 0,8 0,7 0,6 0,5 0,4 0,3 z M14,1 L15,1 15,2 14,2 z M1,1 L2,1 2,2 1,2 z M2,0 L3,0 4,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 13,0 14,0 14,1 13,1 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 3,1 2,1 z" Fill="{StaticResource GridView_EditIndicatorBackground3}" Stretch="Fill"/>
                                <Path Data="M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 12,2 12,3 12,4 12,5.0000001 12,6 11,6 10,6 9,6 8,6 7,6 6,6 5,6 4,6 4,5.0000001 3,5.0000001 3,4 3,3 3,2 3,1 4,1 z M0,0 L1,0 1,1 2,1 2,2 2,3 2,4 2,5.0000001 1,5.0000001 1,6 0,6 0,5.0000001 0,4 0,3 0,2 0,1 z" Fill="{StaticResource GridView_EditIndicatorBackground4}" Margin="2" Stretch="Fill"/>
                            </Grid>


I am attaching you sample project which demonstrates how this can be achieved. 



All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Randy
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Randy
Top achievements
Rank 1
Share this question
or