Custom icon IndicatorPresenter when row is not valid

8 posts, 0 answers
  1. Valentin
    Valentin avatar
    102 posts
    Member since:
    Mar 2016

    Posted 20 Oct Link to this post

    Hello,

     

    I want to modify the icon that will be showed when a row in RadGridView is not valid. I found topics in yours forum, but just for WinForms, and the used event is not exists in WPF.

    For WinForms, the ViewCellFormatting event is used, but I don't find the equivalent event for WPF.

     

    Can you help me ?

     

    Thank you.

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    42 posts

    Posted 25 Oct Link to this post

    Hello Valentin,

    In order to modify the error icon, you can get the ControlTemplate of the RadGridView. The error indicator can be found in the GridViewRow ControlTemplate under the x:Name ErrorIndicator. You can read more about how to extract the ControlTemplate in our Editing Control Templates article. You can also read more about Validation events the RadGridView in our documentation.

    I hope you find this helpful. Let me know if I can be of any further assistance.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Valentin
    Valentin avatar
    102 posts
    Member since:
    Mar 2016

    Posted 26 Oct in reply to Vladimir Stoyanov Link to this post

    Hello,

     

    I'm trying to use your first help link, but I don't find the ErrorIndicator property :

    <Style x:Key="GridErrorRowIcon" TargetType="telerik:GridViewRow">
                <Setter Property="Template" >
                    <Setter.Value>
                        <ControlTemplate >
                             
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                 
            </Style>

     

    How I can find it ?

     

    Thanks.

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    42 posts

    Posted 30 Oct Link to this post

    Hello Valentin,

    Please keep in mind that you need to extract the desired control template for the theme you are using in your application. I am attaching a project which has the GridViewRow ControlTemplate from the Office_Black theme extracted for your reference. You can modify the element with x:Name ErrorIndicator in order to change the appearance of the error indicator.

    I hope this helps. Don't hesitate to contact us again if you have any further questions.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Valentin
    Valentin avatar
    102 posts
    Member since:
    Mar 2016

    Posted 31 Oct Link to this post

    Hello,

     

    Thank you for the project but the build failed. And I can't start it... There are problems with themes, GridViewPinButton etc...

     

    So, is it possible to modify this icon easily ? The code you showed me is very strong.

     

    Thank you.

  6. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    42 posts

    Posted 01 Nov Link to this post

    Hello Valentin,

    I am afraid that there is no easier way to modify the GridViewRow ErrorIndicator.

    In order to run the project from my last reply, you will need to add the required references for the project which are:
    • Telerik.Windows.Controls
    • Telerik.Windows.Controls.GridView
    • Telerik.Windows.Controls.Input
    • Telerik.Windows.Data
    • Telerik.Windows.Themes.Office_Black

    Please note that you need to add NoXaml binaries. The are located in the Binaries.NoXAML folder in the installation folder of UI for WPF. I have commented the section of the ControlTemplate which you need to edit.

    I hope this helps. Let me know if you need any further assistance.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  7. Valentin
    Valentin avatar
    102 posts
    Member since:
    Mar 2016

    Posted 02 Nov in reply to Vladimir Stoyanov Link to this post

    Hello,

     

    It's ok with the NoXaml binaries. The build and debug succeded, and I can use your demo. So, I should to copy all of the Style resource or I can use just the following part ?

    <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Visibility="Collapsed">
                                                        <Path
                                                            Fill="{StaticResource GridView_ErrorIndicatorBackground1}"
                                                            Stretch="Fill"
                                                            Margin="1"
                                                            Data="M3,12.999999 L4,12.999999 5,12.999999 6,12.999999 7,12.999999 8,12.999999 9,12.999999 10,12.999999 11,12.999999 11,13.999999 10,13.999999 9,13.999999 8,13.999999 7,13.999999 6,13.999999 5,13.999999 4,13.999999 3,13.999999 z M11,11.999999 L12,11.999999 12,12.999999 11,12.999999 z M2.0000001,11.999999 L3,11.999999 3,12.999999 2.0000001,12.999999 z M12,10.999999 L13,10.999999 13,11.999999 12,11.999999 z M1,10.999999 L2.0000001,10.999999 2.0000001,11.999999 1,11.999999 z M13,2.9999992 L14,2.9999992 14,3.9999992 14,4.9999992 14,5.9999992 14,6.9999992 14,7.9999992 14,8.9999992 14,9.9999992 14,10.999999 13,10.999999 13,9.9999992 13,8.9999992 13,7.9999992 13,6.9999992 13,5.9999992 13,4.9999992 13,3.9999992 z M0,2.9999992 L1,2.9999992 1,3.9999992 1,4.9999992 1,5.9999992 1,6.9999992 1,7.9999992 1,8.9999992 1,9.9999992 1,10.999999 0,10.999999 0,9.9999992 0,8.9999992 0,7.9999992 0,6.9999992 0,5.9999992 0,4.9999992 0,3.9999992 z M12,1.9999999 L13,1.9999999 13,2.9999992 12,2.9999992 z M1,1.9999999 L2.0000001,1.9999999 2.0000001,2.9999992 1,2.9999992 z M11,0.99999994 L12,0.99999994 12,1.9999999 11,1.9999999 z M2.0000001,0.99999994 L2.9999998,0.99999994 2.9999998,1.9999999 2.0000001,1.9999999 z M2.9999998,0 L3.9999998,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 3.9999998,0.99999994 2.9999998,0.99999994 z"/>
                                                        <Path
                                                            Fill="{StaticResource GridView_ErrorIndicatorBackground2}"
                                                            Stretch="Fill"
                                                            Margin="7 3"
                                                            Data="M1.4901161E-07,8 L1.0000001,8 2.0000002,8 2.0000002,9 2.0000002,10 1.0000003,10 1.0000003,9 1.0000001,10 1.4901161E-07,10 1.4901161E-07,9 z M1.4901161E-07,0 L1.0000001,0 2.0000002,0 2.0000002,1 2.0000002,2 2.0000002,3 2.0000002,4.0000001 2.0000002,5 2.0000002,5.9999999 2.0000002,7 1.0000001,7 1.4901161E-07,7 1.4901161E-07,5.9999999 1.4901161E-07,5 1.4901161E-07,4.0000001 1.4901161E-07,3 1.4901161E-07,2 0,1 z"/>
                                                        <Path Fill="{StaticResource GridView_ErrorIndicatorBackground3}" Stretch="Fill" Data="M4,15 L5,15 6,15 7,15 8,15 9,15 10,15 11,15 12,15 12,16 11,16 10,16 9,16 8,16 7,16 6,16 5,16 4,16 z M12,14 L13,14 13,15 12,15 z M3,14 L4,14 4,15 3,15 z M13,13 L14,13 14,14 13,14 z M2,13 L3,13 3,14 2,14 z M14,12 L15,12 15,13 14,13 z M1,12 L2,12 2,13 1,13 z M7,11 L7,12 7,13 8,13 9,13 9,12 9,11 8,11 z M15,4 L16,4 16,5 16,6 16,7 16,8 16,9 16,10 16,11 16,12 15,12 15,11 15,10 15,9 15,8 15,7 15,6 15,5 z M0,4 L1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 0,12 0,11 0,10 0,9 0,8 0,7 0,6 0,5 z M14,3 L15,3 15,4 14,4 z M7,3 L7,4 7,5 7,6 7,7 7,8 7,9 7,10 8,10 9,10 9,9 9,8 9,7 9,6 9,5 9,4 9,3 8,3 z M1,3 L2,3 2,4 1,4 z M13,2 L14,2 14,3 13,3 z M4,2 L5,2 6,2 7,2 8,2 9,2 10,2 11,2 12,2 12,3 13,3 13,4 14,4 14,5 14,6 14,7 14,8 14,9 14,10 14,11 14,12 13,12 13,13 12,13 12,14 11,14 10,14 9,14 8,14 7,14 6,14 5,14 4,14 4,13 3,13 3,12 2,12 2,11 2,10 2,9 2,8 2,7 2,6 2,5 2,4 3,4 3,3 4,3 z M2,2 L3,2 3,3 2,3 z M12,1 L13,1 13,2 12,2 z M3,1 L4,1 4,2 3,2 z M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 z"/>
                                                         
                                                    </Grid>

     

    I can set a custom pictures via its name in static resources ?

     

    Thank you.

  8. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    42 posts

    Posted 06 Nov Link to this post

    Hi Valentin,

    In order to modify the GridViewRow, you need to include the entire control template in your application. Then you can just change the Path's in the ErrorIndicator element to modify its visual appearance. Here is a little bit simplified version of the ErrorIndicator's paths:
    <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Visibility="Collapsed">
                                                        <Path
                                                            Fill="{StaticResource GridView_ErrorIndicatorBackground1}"
                                                            Stretch="Fill"
                                                            Margin="1"
                                                            Data="M11,12 L12,12 12,13 11,13 z M2,12 L3,12 3,13 2,13 z M12,11 L13,11 13,12 12,12 z M1,11 L2,11 2,12 1,12 z M13,3 L14,3 14,11 13,11 M12,2 L13,2 13,3 12,3 z M1,2 L2,2 2,3 1,3 z M11,1 L12,1 12,2 11,2 z M2,1 L3,1 3,2 2,2 z M1,11 L0,11 0,3 1,3 M3,1 L3,0 11,0 11,1 M11,13 L11,14 3,14 3,13 "/>
                                                        <Path
                                                            Fill="{StaticResource GridView_ErrorIndicatorBackground2}"
                                                            Stretch="Fill"
                                                            Margin="7 3"
                                                            Data="M0,8 L2,8 2,10 0,10 z M0,0 L2,0 2,7 0,7 z "/>
                                                        <Path
                                                            Fill="{StaticResource GridView_ErrorIndicatorBackground3}"
                                                            Stretch="Fill"
                                                            Data="M12,14 L13,14 13,15 12,15 z M3,14 L4,14 4,15 3,15 z M13,13 L14,13 14,14 13,14 z M2,13 L3,13 3,14 2,14 z M14,12 L15,12 15,13 14,13 z M1,12 L2,12 2,13 1,13 z M15,4 L16,4 16,12 15,12 M1,12 L0,12 0,4 1,4 M14,3 L15,3 15,4 14,4 z M9,10 L9,3 7,3 7,10 M1,3 L2,3 2,4 1,4 z M13,2 L14,2 14,3 13,3 z M2,4 L3,4 3,3 4,3 4,2 12,2 12,3 13,3 13,4 14,4 14,12 13,12 13,13 12,13 12,14 4,14 4,13 3,13 3,12 2,12 M2,2 L3,2 3,3 2,3 z M12,1 L13,1 13,2 12,2 z M3,1 L4,1 4,2 3,2 z M4,1 L4,0 12,0 12,1 M12,15 L12,16 4,16 4,15 M7,13 L9,13 9,11 7,11"/>
                                                         
                                                    </Grid>

    I hope this helps. Don't hesitate to contact us if you have any further questions.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top