Getting Validation Message RadDataForm

4 posts, 0 answers
  1. Jawad
    Jawad avatar
    10 posts
    Member since:
    Jul 2013

    Posted 16 Dec 2013 Link to this post

    we are using Telerik RadDataForm in Our product which is using MVVM Pattern. we want to use our custom Commads  and Button for Commit and Cancel and to get this we are referencing RadDataFormStyle to set the command as shown.

    <StackPanel x:Name="PART_FooterPanel" HorizontalAlignment="Right" Orientation="Horizontal">
                                      <telerik:RadButton x:Name="PART_CommitButton" Content="{TemplateBinding CommitButtonContent}" Command="{Binding Source={StaticResource DataContextProxy}, Path=Data.UpdateItem}"  InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                          <telerik:StyleManager.Theme>
                                              <telerik:Office_BlackTheme/>
                                          </telerik:StyleManager.Theme>
                                      </telerik:RadButton>
                                      <telerik:RadButton x:Name="PART_CancelButton" Content="{TemplateBinding CancelButtonContent}" Command="{Binding Source={StaticResource DataContextProxy},Path=Data.CancelItemUpdate}" InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                          <telerik:StyleManager.Theme>
                                              <telerik:Office_BlackTheme/>
                                          </telerik:StyleManager.Theme>
                                      </telerik:RadButton>
                                  </StackPanel>

    and following is the Rad Form Defined on the View. the CommandButtonsVisibility="None" is set to None because we don't want to see the navigation and other controls being used.
     
    <telerik:RadDataForm x:Name="DataForm1"<br>                                     CurrentItem="{Binding CurrentLevelItem,UpdateSourceTrigger=PropertyChanged}"<br>                                     Style="{StaticResource RadDataFormStyle1}"<br>                                      DataFieldStyle="{StaticResource DataFormDataFieldStyle1}" AutoEdit="True" CommandButtonsVisibility="None"  /> 

    The fields are auto generated and the problem is we want to get hold of the ValidationSummay in the View Model (if the condition of a text field etc is not met the Auto-generated validation Summary is Bound to a property in the view Model etc)to show it according to our requirements(i.e. on one of our self created Control to show information or errors etc) .
    Is there a way to get hold of the validationSummay in the view Model?.

    Thanks,
    Jawad.
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 19 Dec 2013 Link to this post

    Hi,

    Basically, RadDataForm exposes a ValidationSummary property that contains the validation errors in its Errors collection. You can create a MVVM-friendly attached behavior that manages it at runtime. Additionally you can control ValidationSummary's visibility through the ValidationSummaryVsibility property. In case you need any additional assistance on this matter, I can prepare a sample project for you, but I will need some additional information on what exactly you are trying to achieve?

    Regards,
    Ivan Ivanov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Jawad
    Jawad avatar
    10 posts
    Member since:
    Jul 2013

    Posted 02 Jan 2014 Link to this post

    Hi,

     It will be great If you can attach an example project on how to set attached behaviour to RadDataForm. following two main requirements we want to Achieve:

    1): Firstly We have a Custom messageBar Control to display error messages in our Application. so I have Disabled the ValidationSummaryVisibility and  to populate the message bar I have to get hold of the RadDataform's Errors Collection in the View Model.

    2):  We also want to use our own defined Cancel and Commit buttons as our Design Requirements. which means we will not be using the Commit and Cancel Buttons provided by the RadDataform. but we still want the Auto validation to be carried out on  commit command  (to give custom defined Commit buttons the same functionality as the default Rad commit Buttons) and any Validation Error will then be shown in the Message Bar.

    Thanks,
    Jawad.
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 07 Jan 2014 Link to this post

    Hi Jawad,

    Can you please shed some more light on your customization of Commit and Cancel buttons. They are bound to commands that trigger the validation logic internally? How do you plan to replace them? You can use a custom commands provider to override their default behavior. If you have some working code that illustrates your ideas, you can send it to us and I will try to encorporate it in a sample project.

    Regards,
    Ivan Ivanov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top