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

Problem with Radtreeview checklist

3 Answers 98 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Vittorio Morellini
Top achievements
Rank 1
Vittorio Morellini asked on 05 Mar 2010, 12:23 PM

If I put IsTriStateMode="True", I have problem because after I save on DB, if I check the parent node, the children are not checked.
The first time it works, after I save on the DB and the page is reloaded it happens the following error: 
when I check the parent only the first or the second child is checked (one time the first, second time the second) and the parent is not checked, or If I have checked some child the following child is checked and the others child that were checked are not more checked and the parent is not more checkable and it remains unchecked.
Is this due to the hierarchical data template ? here is the xaml:

<

 

UserControl.Resources>

 

 

 

<slv:ValidatorManager x:Name="ProfileValidator"></slv:ValidatorManager>

 

 

 

 

<converters:CheckToProfileConverter x:Name="checkToProfileConverter"></converters:CheckToProfileConverter>

 

 

 

<converters:BooleanToVisibilityConverter x:Name="booleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>

 

 

 

 

<tlkControls:ContainerBindingCollection x:Key="TreeItemContainerBindings">

 

 

 

<tlkControls:ContainerBinding

 

 

PropertyName="CheckState"

 

 

Binding="{Binding IsChecked, Converter={StaticResource checkToProfileConverter}, Mode=TwoWay}" />

 

 

 

 

</tlkControls:ContainerBindingCollection>

 

 

 

 

<tlkControls:HierarchicalDataTemplate x:Key="MenuItemsTemplate"

 

 

ItemsSource="{Binding ItemsWrapped, Mode=TwoWay}"

 

 

tlkControls:ContainerBinding.ContainerBindings="{StaticResource TreeItemContainerBindings}">

 

 

 

 

<StackPanel Orientation="Horizontal">

 

 

 

<Grid>

 

 

 

<Grid.ColumnDefinitions>

 

 

 

<ColumnDefinition Width="2*"></ColumnDefinition>

 

 

 

<ColumnDefinition Width="1"></ColumnDefinition>

 

 

 

<ColumnDefinition Width="Auto"></ColumnDefinition>

 

 

 

<ColumnDefinition Width="1"></ColumnDefinition>

 

 

 

<ColumnDefinition Width="150"></ColumnDefinition>

 

 

 

</Grid.ColumnDefinitions>

 

 

 

<Image Grid.Column="0" Source="{Binding Immagine}" Height="16" Margin=" 0,0,6,0" />

 

 

 

<TextBlock Grid.Column="2" Text="{Binding Titolo}" Height="16" Foreground="Black" FontSize="12" Width="150" />

 

 

 

<tlkEx:RadComboBoxEx x:Name="cmbOperazione"

 

 

Visibility="{Binding IsChecked, Converter={StaticResource booleanToVisibilityConverter}, Mode=TwoWay}"

 

 

Width="100"

 

 

IsTextSearchEnabled="True"

 

 

HorizontalAlignment="Left"

 

 

Grid.Column="4"

 

 

Margin="0 0 22 0"

 

 

ItemsSource="{Binding OperazioneItems, Mode=TwoWay}"

 

 

SelectedItem="{Binding OperazioneSel, Mode=TwoWay}"

 

 

SelectedValue="{Binding OperazioneSel.IdOperazione, Mode=OneTime}"

 

 

SelectedValuePath="IdOperazione"

 

 

DisplayMemberPath="Descrizione"

 

 

>

 

 

 

<slv:ValidatorService.Validator>

 

 

 

<slv:RequiredRadComboValidator ManagerName="ProfileValidator" ErrorMessage="{Binding Path=Strings.anagValidatorRequired, Source={StaticResource resx}}" />

 

 

 

</slv:ValidatorService.Validator>

 

 

 

</tlkEx:RadComboBoxEx>

 

 

 

</Grid>

 

 

 

</StackPanel>

 

 

 

</tlkControls:HierarchicalDataTemplate>

 

 

 

</UserControl.Resources>

 

 

 

<Grid x:Name="LayoutRoot" Background="White">

 

 

 

<common:loader x:Name="profileLoader" Visibility="Collapsed" />

 

 

 

<tlkNavigation:RadTreeView x:Name="gvTree"

 

 

HorizontalAlignment="Left" VerticalAlignment="Top"

 

 

SelectionMode="Extended"

 

 

IsOptionElementsEnabled="True"

 

 

ItemsOptionListType="CheckList"

 

 

IsTriStateMode="True"

 

 

ItemTemplate="{StaticResource MenuItemsTemplate}" />

 

 

 

</Grid>

 

3 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 09 Mar 2010, 03:24 PM
Hello Vittorio,

The problem is probably caused by the ContainerBindings to the IsChecked property and/or the converters used. However, I cannot tell for sure without being able to run and debug the application since the code you pasted shows the scenario is not simple to reproduce.

Sincerely yours,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vittorio Morellini
Top achievements
Rank 1
answered on 12 Mar 2010, 05:07 PM
Yes It's probably as you are telling me.
The is checked property is linked to the checkstate with a conversion:

 

public class CheckToProfileConverter : IValueConverter

 

{

#region

 

IValueConverter Members

 

 

public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)

 

{

 

if (value == null)

 

 

return System.Windows.Automation.ToggleState.Off;

 

 

if ((bool)value)

 

 

return System.Windows.Automation.ToggleState.On;

 

 

else

 

 

return System.Windows.Automation.ToggleState.Off;

 

}

 

public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)

 

{

 

return ((System.Windows.Automation.ToggleState)value == System.Windows.Automation.ToggleState.On);

 

}

#endregion

}



Here is the class that manage the conversion between the check state and the ischecked property on xaml.
To have the tree checked the ThreeState do I have to use the ToggleState.Indeterminate ?

King Regards
Vittorio Morellini
0
Tihomir Petkov
Telerik team
answered on 17 Mar 2010, 03:19 PM
Hi Vittorio,

Yes, if you want to use the TriStateMode you will need to keep in mind the Indeterminate state in your convertor. Basically the mapping should be like so:

true = On
false = Off
null = Indeterminate


Greetings,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Vittorio Morellini
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Vittorio Morellini
Top achievements
Rank 1
Share this question
or