Selected Value is always null (Items Source is bound to XmlDataProvider)

4 posts, 0 answers
  1. Igor Stefanovic
    Igor Stefanovic avatar
    12 posts
    Member since:
    May 2010

    Posted 07 Feb Link to this post

    I have simple xml bound to RadListBox using XmlDataProvider. Xml is simple and it looks like this:

    <Views><br>  <View Caption="PARTIES" Path="/Views/PartyView.xaml" /><br>  <View Caption="CANDIDATES" Path="/Views/CandidateView.xaml" /><br>  <View Caption="CANDIDATE POSITIONS" Path="/Views/CandidatePositionView.xaml" /><br>  <View Caption="ELECTION" Path="/Views/ElectionView.xaml" /><br></Views>

    Provider is set like this:

    <XmlDataProvider x:Key="xdpViews" Source="/Menu/Views.xml" XPath="Views/View"/>

    And RadListBox looks like this:

    <telerik:RadListBox BorderThickness="0,0,2,0" x:Name="lbViews"<br>                            SelectionChanged="lbViews_SelectionChanged"<br>                            SelectedValuePath="@Path"    <br>                            DisplayMemberPath="@Caption"><br>            <telerik:RadListBox.ItemsSource><br>                <Binding Source="{StaticResource xdpViews}"/><br>            </telerik:RadListBox.ItemsSource><br>        </telerik:RadListBox>

     

    While DisplayMemberPath works as intended and list box display captions, when I select item selected value is always null. Am I missing something or this is the bug in RadListBox control?

  2. Stefan
    Admin
    Stefan avatar
    794 posts

    Posted 10 Feb Link to this post

    Hello Igor,

    Generally speaking, the selection mechanism of the control does not depend on the type of data source it is populated with. If the data source is properly loaded, the selection should be behaving as expected. With this in mind, may I kindly ask you to try replicating the same behavior with a standard MS ListBox? Does it differentiate in any manner?

    Regards,
    Stefan X1
    Telerik by Progress
    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. Igor Stefanovic
    Igor Stefanovic avatar
    12 posts
    Member since:
    May 2010

    Posted 10 Feb in reply to Stefan Link to this post

    With regular ListBox it works just fine. When I select item selected value is updated accordingly. It looks like problem with RadListBox.
  4. Stefan
    Admin
    Stefan avatar
    794 posts

    Posted 15 Feb Link to this post

    Hi Igor,

    Thank you for this clarification.

    After investigating the case, it seems that the problem is indeed with RadListBox. I have logged it in our bug tracking system. You can track its state in the Feedback Portal: When using an XML as a data source and the SelectedValuePath is set, the SelectedValue is always null.

    As stated in the description of the item, you can utilize the SelectedItem property of the control as a workaround.

    I have also updated your Telerik points as a token of gratitude for your cooperation in reporting the issue.

    All the best,
    Stefan X1
    Telerik by Progress
    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