Telerik Forums
UI for WPF Forum
3 answers
342 views
Hi guys,

The problem is that in the property box we have, when the user types a string in a field that’s bound to a float property the by default  error is displayed. The customer wants  to display some nice user friendly errors.
 
I have a property grid (called AssociatedObject), and for this property grid I add the PropertyDefinitions from code (using a Behavior)  like this:

The AssociatedObject is of type RadPropertyGrid

foreach (CustomerCustomFieldVMv customField in propertyItemsForCompanyList)

            {

                Binding bind = new Binding();

                switch (customField.ValueType)

                {

                    case CustomFieldValueType.Float:

                       
                 //custom field is of type float

                       
              bind = new Binding

                          
           {

                               Source =customField,

                               Path = new PropertyPath("FloatValue"),

                               Mode = BindingMode.TwoWay,

                              
                              UpdateSourceTrigger = UpdateSourceTrigger.LostFocus,

                              
                              ValidatesOnDataErrors = true,

                              
                              NotifyOnValidationError = true

                          
};

                        bind.ValidationRules.Add(new NumericFieldValidation());

                       
                    break;

                    case CustomFieldValueType.String:

                       
                                     //custom field is of type string

                       
                                    bind = new Binding

                           {

                               Source =customField,

                               Path = new PropertyPath("StringValue"),

                               Mode = BindingMode.TwoWay

                          
                    };

                       
                     break;

                    default:

                       
                    break;

                }

                var newDefinition = new PropertyDefinition()

                         
{

                              Binding = bind,

                              DisplayName =
customField.Description,

                              IsReadOnly = false

                         
};

 

               
AssociatedObject.PropertyDefinitions.Add(newDefinition);

            }

The FloatValue property is of type float and the StringValue is of type string. The values are bind and displayed correctly.

 

The class where I want to do the validation is NumericFieldValidation. It’s looking like this:

public class NumericFieldValidation : ValidationRule

    {

        private string invalidInput = “error wrong format”;

 

        // Implementing the abstract method in the Validation Rule class

        public override ValidationResultValidate(object value,System.Globalization.CultureInfo cultureInfo)

        {

            float val;

            if(!string.IsNullOrEmpty((string)value))

            {

                // Validates weather Non numeric values are entered as float value

                if(!float.TryParse(value.ToString(),out val))

                {

                    return new ValidationResult(false,invalidInput);

                }

            }

 

            return new ValidationResult(true,null);

        }

    }

In order to display the errors visual studio throws I use tooltip messages.

<telerik:RadPropertyGrid.Resources>

                <Style TargetType="{x:Type TextBox}">

                    <Style.Triggers>

                       
<Trigger Property="Validation.HasError" Value="True">

                           
<Trigger.Setters>

                                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors).CurrentItem}"/>

                                <Setter Property="BorderBrush" Value="Red"/>

                                <Setter Property="Background" Value="#FFCCCC"/>

                           
</Trigger.Setters>

                        </Trigger>

</Style>

</telerik:RadPropertyGrid.Resources>

 

The problem I have is that when I type something in the FloatValue field inside the property grid I would like it  to go to the Validate method from NumericFieldValidation, but it’s not. It ignores the Validation rule I added for the FloatValue property.

Can you please help me with a solution? It would be very helpful if the binding would send the user to NumericFieldValidation class for validation.

Best regards,
Adriana
 
Dimitrina
Telerik team
 answered on 05 Aug 2014
1 answer
146 views
Hi,

Is there a way to get how many rows are visible and the index of first row showing in the SrollViewer? I have tried to get ScrollViewer to get ViewPortHeight and VerticalOffset, but they are in pixels instead of the the number of items even if I set CanContentScroll=true?

Thanks in advance.

Cho
Dimitrina
Telerik team
 answered on 05 Aug 2014
14 answers
304 views
Hi,

When I create a new Appointment as AllDayEvent it does not look any different from a normal event, is there any way to make it outstanding? So when someone looks at the ScheduleView he/she can instantly see that this is all day event? For example in Outlook these events are move to the top (see the attachment), so I can see them at any time when I look at the particular date. Otherwise I would have no clue that this is all day event untill I actually open it.

Is there any way to achieve this?

 

Kind Regards

Rob
Top achievements
Rank 1
 answered on 05 Aug 2014
1 answer
349 views
Hi,
The below code is used to give the user the option for adding formatted text. Like in excel, when the user is adding contents to right footer, the cursor starts from the right. Similarly, i want the cursor to start from the right for the below text box.

For the center footer text box, the contents should get aligned center. Please help me in this regard.

 <telerik:RadRichTextBox Grid.Row="1" Grid.Column="0"  HorizontalAlignment="Left" Name="TxtRightFooterBox" IsSpellCheckingEnabled="False" IsContextMenuEnabled="False" IsSelectionMiniToolBarEnabled="False"
                                    DocumentInheritsDefaultStyleSettings="True"  GotFocus="TxtRightFooterBox_OnGotFocus" Visibility="Visible" Width="175" Height="125" Margin="5">
                <telerik:RadRichTextBox.Document>
                    <telerik:RadDocument>
                        <telerik:Section>
                            <telerik:Paragraph FontSize="10">
                                <telerik:Span FontFamily="Arial" Text=" "  FontSize="10" />
                            </telerik:Paragraph>
                        </telerik:Section>
                    </telerik:RadDocument>
                </telerik:RadRichTextBox.Document>
            </telerik:RadRichTextBox>

Thanks,
Petya
Telerik team
 answered on 05 Aug 2014
1 answer
122 views
The Q1 2013 release notes specifies that a way to "make the row expand automatically in MonthViewDefinition when there are more appointments" was added, but I can't seem to find how to accomplish this.
Yana
Telerik team
 answered on 05 Aug 2014
2 answers
119 views
I have some appointments with short durations (1 minute). In Vertical orientation (e.g. the default DayView) this only shows as a line.

I found out about the option "EnableSmallAppointmentRendering", but when I set this the appointment takes too much space.
Is it possible to set this?

The attached file presents such an example. The item only takes 2 minutes, but the item is displayed covering a big block. Ideally this should be set. Can it be done?

Jim

Jim
Top achievements
Rank 1
 answered on 05 Aug 2014
3 answers
166 views
I add and remove RadPanes from my DocumentHost in code.  When I add or remove a panel I want to animate it i.e. slide the panel in or out from the right.  Is there a code example posted that will tell me how to do that using Animation Manager?


Thanks,

Sam
Masha
Telerik team
 answered on 05 Aug 2014
5 answers
192 views
We are using the RadPDFViewer from the Q3 2013 sp 2 release and it cannot seem to load PDF's that were scanned.  Looking around the web I've found that it might be an issue with the decoder but found that the scanned pdf's I've been working with use DCTDecode which Telerik list as fully supported (http://www.telerik.com/help/wpf/radpdfviewer-customize-pdf-rendering.html)

Would I have to create a custom filter for the pdf viewer or is there another reason behind this issue?

Thanks,
Kyle
Kyle
Top achievements
Rank 1
 answered on 04 Aug 2014
1 answer
84 views
hi,
I’m using gridview in rowFilter mode. When I select  ClearFilter item, the text in textbox does not clear.
how to enforce clear textbox text in gridview filtered event?
Dimitrina
Telerik team
 answered on 04 Aug 2014
6 answers
250 views
I'm not sure whether this is a bug or something I haven't done correctly. I have the following very simple codes in an XBap:

    <Telerik:RadTreeView IsVirtualizing="True">
      <Telerik:RadTreeViewItem Header="Parent Node">
        <Telerik:RadTreeViewItem Header="Child Node">
          <Telerik:RadTreeViewItem Header="Grandchild Node">
            <Telerik:RadTreeViewItem Header="No idea"></Telerik:RadTreeViewItem>
            </Telerik:RadTreeViewItem>
          </Telerik:RadTreeViewItem>
      </Telerik:RadTreeViewItem>
    </Telerik:RadTreeView>

Please do notice that I set IsVirtualizing to True. If I run it then expand, then collapse a TreeViewItem a few times, the child TreeViewItem header disappear.

My test application is an XBap with Visual Studio 2010 and .Net 4.

Edited: I know the title of the post sounds really weird. I tried to change but there seems to be no way to do that.
Much appreciate for all your help.
Pavel R. Pavlov
Telerik team
 answered on 04 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?