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

Cannot bind to sub property

6 Answers 117 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Serhiy
Top achievements
Rank 1
Serhiy asked on 14 Oct 2009, 04:51 PM
v2009.2.812.1030
I have the following code:

<UserControl  
    x:Class="TestSilverlightApplication.Page" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:radInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" 
    > 
 
    <Grid Background="White">  
 
        <Grid Name="editForm1" Margin="10" VerticalAlignment="Top">  
            <Grid.RowDefinitions> 
                <RowDefinition /> 
            </Grid.RowDefinitions> 
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="Auto" /> 
                <ColumnDefinition Width="100" /> 
                <ColumnDefinition Width="Auto" /> 
                <ColumnDefinition Width="150" /> 
            </Grid.ColumnDefinitions> 
 
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Position:" HorizontalAlignment="Right" VerticalAlignment="Center" FontWeight="Bold" Margin="5" /> 
            <radInput:RadNumericUpDown Grid.Row="0" Grid.Column="1" Name="SequenceNumber" Value="{Binding Path=Id.SequenceNumber, Mode=TwoWay}" SmallChange="1" ValueFormat="Numeric" HorizontalContentAlignment="Right" Margin="5" /> 
 
            <TextBlock Grid.Row="0" Grid.Column="2" Text="Valid Characters:" HorizontalAlignment="Right" VerticalAlignment="Center" FontWeight="Bold" Margin="5" /> 
            <TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Path=ValueCharacters, Mode=TwoWay}" Margin="5" IsEnabled="True" /> 
        </Grid> 
 
    </Grid> 
</UserControl> 
using System;  
using System.Globalization;  
 
namespace TestSilverlightApplication  
{  
    public partial class Page  
    {  
        public Page()  
        {  
            InitializeComponent();  
 
            SequenceNumber.Minimum = Int32.MinValue;  
            SequenceNumber.Maximum = Int32.MaxValue;  
            SequenceNumber.NumberFormatInfo = new NumberFormatInfo { NumberDecimalDigits = 0 };  
 
            WarehouseDetail1 detl1 = new WarehouseDetail1  
                                        {  
                                            Id = new WarehouseDetail1Id { SequenceNumber = 1 },  
                                            ValueCharacters = "abcd",  
                                        };  
 
            editForm1.DataContext = detl1;  
        }  
    }  
 
    public class WarehouseDetail1  
    {  
        public WarehouseDetail1Id Id { getset; }  
 
        public string ValueCharacters { getset; }  
    }  
 
    public class WarehouseDetail1Id  
    {  
        public int SequenceNumber { getset; }  
    }  
}  
 

It raises NullReferenceException in the "editForm1.DataXontext = detl1" line.
If I move "SequenceNumber" proeprty to WarehouseDetail1 and change binding everything works as expected.

Does RadNumericUpDown support binding to sub properties ?

PS.
Checked the source code, looks like a problem in RadRangeBase.cs line:

var attributes = classType.GetProperty(bindingExpression.ParentBinding.Path.Path).GetCustomAttributes(typeof(RangeAttribute), false); 

6 Answers, 1 is accepted

Sort by
0
Stephane Priolet
Top achievements
Rank 1
answered on 16 Oct 2009, 09:38 AM
Hi,

I have got exactly the same problem.
0
Accepted
Hristo Borisov
Telerik team
answered on 17 Oct 2009, 02:20 PM
Hello Stephane Priolet and Serhiy Volhushyn,

The issue is already resolved in our internal builds. You can expect a working version of this with our next official release that is coming pretty soon. If this is a show stopper for you, I advice you to download our latest internal build that contains major bug fixes and changes. This will also help you prepare your application for our new version and make the adoption curve smoother.

Thank you for contacting us and we look forward to hearing from you again.

Sincerely yours,
Hristo Borisov
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
Stephane Priolet
Top achievements
Rank 1
answered on 19 Oct 2009, 09:54 AM
Ok, thank you Hristo
0
Serhiy
Top achievements
Rank 1
answered on 21 Oct 2009, 03:30 PM
Thank you.
 We are trying to migrate to Q3 release and everything looks fine, but the problem is that all Themes besides default one crash application (grids). Because of that we cannot migrate to Q3 beta right now (our product is not released yet, but we have to show a lot of demos and without Office Blue theme it does not look very good).
Do you know when at least Office Blue theme will be fixed in internal build ?
0
Valeri Hristov
Telerik team
answered on 23 Oct 2009, 10:39 AM
Hello Serhiy,

We are not releasing internal builds for the Beta versions since we cannot guarantee the stability of the controls inside. Unfortunately I will not be able to prepare a custom build just for you since there are many modifications that are made constantly and I cannot quickly verify that everything is OK. The official release is scheduled for the first week of November, where all themes will be available, I hope this timeframe is acceptable enough.

All the best,
Valeri Hristov
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
Serhiy
Top achievements
Rank 1
answered on 23 Oct 2009, 01:34 PM
Thank you for the response. Beginning of November works perfectly for us.
Tags
NumericUpDown
Asked by
Serhiy
Top achievements
Rank 1
Answers by
Stephane Priolet
Top achievements
Rank 1
Hristo Borisov
Telerik team
Serhiy
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or