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

TreeListView set selected child item mvvm not work

6 Answers 75 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
kity
Top achievements
Rank 2
kity asked on 07 Mar 2013, 02:22 PM

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


6 Answers, 1 is accepted

Sort by
0
kity
Top achievements
Rank 2
answered on 19 Mar 2013, 03:07 PM
72 visits and still not any comment.
Nice ;)
0
Rob Conley
Top achievements
Rank 1
answered on 04 May 2013, 08:02 PM
Same problem here.

Did you find a solution?
0
Rob Conley
Top achievements
Rank 1
answered on 05 May 2013, 09:19 PM
Actually, I'm not having that problem anymore. Not sure what I did to fix it.
0
kity
Top achievements
Rank 2
answered on 17 May 2013, 08:00 AM
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.
0
DONTASK
Top achievements
Rank 1
answered on 02 Mar 2017, 03:15 AM
I'm having the same issue!!! Not sure how to solve it. And Telerik doesn't respond or fix it. What a Great product ever!
0
Stefan
Telerik team
answered on 06 Mar 2017, 01:25 PM
Hello,

By design, RadTreeListView is meant to be used with homogeneous data only. This is documented in the Getting Started section of the control. Can you please check it out?

Best Regards,
Stefan X1
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeListView
Asked by
kity
Top achievements
Rank 2
Answers by
kity
Top achievements
Rank 2
Rob Conley
Top achievements
Rank 1
DONTASK
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or