TreeListView set selected child item mvvm not work

5 posts, 0 answers
  1. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 07 Mar 2013 Link to this post

    TreeListView set selected child item mvvm

    SelectedItem="{Binding}" work only for a first level(parent nodes), not for a child.

    I am familiar with "SelectionChanged" event, but I want to not use. Can you provaid information for MVVM Selected Item for ChildTableDefinitions.

    If select first level SelectedService property work, if select some of child setter of property not work.

    XAML:

    <telerik:RadTreeListView ItemsSource="{Binding Services, Mode=TwoWay}" SelectedItem="{Binding Path=SelectedService, Mode=TwoWay}" SelectionMode="Single" >
    <telerik:RadTreeListView.ChildTableDefinitions>
    <telerik:TreeListViewTableDefinition ItemsSource="{Binding Details}" />
    </telerik:RadTreeListView.ChildTableDefinitions>
    <telerik:RadTreeListView.Columns>
    <telerik:GridViewDataColumn Header="Status" Width="Auto" IsReadOnly="True">
    <telerik:GridViewDataColumn.CellTemplate>
    <DataTemplate>
    <StackPanel Orientation="Horizontal">
    <Ellipse Fill="{Binding StrokeHex, Converter={StaticResource HexToSolidColorBrushConverter}, Mode=TwoWay}" Stroke="Black" Width="24" Height="24" />
    </StackPanel>
    </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    </telerik:GridViewDataColumn>
    </telerik:RadTreeListView.Columns>
    </telerik:RadTreeListView>

    VIEWMODEL:

    [Display(AutoGenerateField = false)]
    public ObservaryModel SelectedService
    {
    get { return _selectedService; }
    set
    {
    if (_selectedService != value)
    {
    _selectedService = value;
    RaisePropertyChanged(() => SelectedService);
    }
    }
    }
    See Attach image - have two node and x2 childs.

    ---MODEL--
    public class ObservaryModel : ServiceModel
        {
            private IList<ServiceModel> _details = new List<ServiceModel>();
             
            [Display(AutoGenerateField = false)]
            public IList<ServiceModel> Details
            {
                get { return _details; }
                set { _details = value; }
            }
     
            public ObservaryModel(){}
        }

     

     

     

    --IMAGE attached--

     

    http://www.telerik.com/ClientsFiles/436900_selected-child.PNG


  2. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 19 Mar 2013 Link to this post

    72 visits and still not any comment.
    Nice ;)
  3. DevCraft banner
  4. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 04 May 2013 Link to this post

    Same problem here.

    Did you find a solution?
  5. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 05 May 2013 Link to this post

    Actually, I'm not having that problem anymore. Not sure what I did to fix it.
  6. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 17 May 2013 Link to this post

    The only one solution is to use equal class for Node(master) and child(detail).
    Your master and detail must use the same class.

    Why telerik have bug when use classes that have inherited between, I do not know.
Back to Top
DevCraft banner