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

Selectable Region on TreeView Items...

1 Answer 64 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 2
Kevin asked on 04 May 2011, 10:12 AM
Hey again guys, i have another query regarding the TreeView control, at present i use the Tree View to display a list of people, but i have a custom control that displays its contents, but i use the drag and drop functionality of the Tree View, I also have a Contextual RIbbon Bar that is activated when an Item in the RadTreeView is Clicked...

The Problem i have is the control is only selected when a user clicks on the white space between button / Combo box's, clicking on the actual combo boxes, buttons doesnt actually select the TreeViewItem,

Is there any functionality to allow this to happen? as i would really love to keep using the TreeView.

See Below for my Code, Thanks in advance and look forward to your response!!
Kev.

Definition of my Tree View :
<telerikNavigation:RadTreeView HorizontalContentAlignment="Stretch" x:Name="uiActionersList" IsDragDropEnabled="True" DragEnded="uiActionersList_DragEnded"
                                                HorizontalAlignment="Stretch" SelectionMode="Multiple" ScrollViewer.HorizontalScrollBarVisibility="Hidden" dragDrop:RadDragAndDropManager.AllowDrop="True"
                                                                               IsDragPreviewEnabled="True"  IsDragTooltipEnabled="True" SelectionChanged="uiActionersList_SelectionChanged"
                                                ItemsSource="{Binding ActionerModelViewCollection, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True,Mode=TwoWay}" Margin="0,0,-5,0" >
                                            <telerikNavigation:RadTreeView.ItemTemplate>
                                                <DataTemplate>
                                                    <pmControls:ActionerControl x:Name="ItemsHost" />
                                                </DataTemplate>
                                            </telerikNavigation:RadTreeView.ItemTemplate>
                                        </telerikNavigation:RadTreeView>


Definition of Actioner Control :

<Grid Background="White">
        <StackPanel>
            <Grid>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Height="25" Margin="0">
                <telerikControls:RadButton Name="dragHandle" Height="24" Width="11" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,3,0">
                    <telerikControls:RadButton.Content>
                        <Grid>
                            <Line X1="0" Y1="0" X2="3" Y2="0" Stroke="Black" StrokeThickness="1"></Line>
                                <Line X1="0" Y1="5" X2="3" Y2="5" Stroke="Black" StrokeThickness="1"></Line>
                                <Line X1="0" Y1="10" X2="3" Y2="10" Stroke="Black" StrokeThickness="1"></Line>
                        </Grid>
                    </telerikControls:RadButton.Content>
                </telerikControls:RadButton>
                    <Image Width="25" Height="25" Source="{Binding SelectedActioner, Converter={StaticResource ReturnImageBasedOnTypeConverter}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, NotifyOnTargetUpdated=True}">
                         
                    </Image>
                    <DockPanel Width="300" LastChildFill="True" Margin="3,1,0,0">
                        <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Name="uiCreationButtons" Visibility="{Binding HasGotThisJobOrGroup, Converter={StaticResource CollapsedOnTrueConverter}}">
                            <telerikControls:RadButton Content="New Group" Width="70" Margin="0,0,3,0" Padding="0" HorizontalAlignment="Right" Click="ActionerGroupButton_Click" />
                            <telerikControls:RadButton Content="New Job" Width="70" Margin="0" Padding="0" HorizontalAlignment="Right" Click="ActionerJobButton_Click"/>
                        </StackPanel>
                        <telerikControls:RadComboBox Name="uiActionerNamesComboBox" IsEditable="True"
                        IsReadOnly="False" Margin="0,0,3,0" ItemsSource="{Binding AllAgilityJobDocs}" SelectedValue="{Binding SelectedActioner, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnTargetUpdated=True}"
                        KeyUp="uiActionerNamesComboBox_KeyUp"  telerikControls:TextSearch.TextPath="Title" HorizontalAlignment="Stretch" EmptyText="{Binding ThisActioner.Position, Converter={StaticResource EmptyActionerTextConverter}}">
                            <telerikControls:RadComboBox.FontWeight>
                                <MultiBinding Converter="{StaticResource ActionerBoldTextMultiBindingConverter}" Mode="OneWay">
                                    <Binding Path="SelectedActioner"/>
                                    <Binding Path="NewAgilityJobDocs"/>
                                </MultiBinding>
                            </telerikControls:RadComboBox.FontWeight>
                            <telerikControls:RadComboBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Image Height="16" Width="16">
                                            <Image.Style>
                                                <Style TargetType="Image">
                                                    <Style.Triggers>
                                                        <DataTrigger  Binding="{Binding ItemType}" Value="Job" >
                                                            <Setter Property="Source" Value="{StaticResource JobDocImage}"/>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding ItemType}" Value="Group" >
                                                            <Setter Property="Source"  Value="{StaticResource GroupImage}"/>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Image.Style>
                                        </Image>
                                        <TextBlock Text="{Binding Title}" FontWeight="Normal" VerticalAlignment="Center" Margin="5,0,0,0"/>
                                    </StackPanel>
                                </DataTemplate>
                            </telerikControls:RadComboBox.ItemTemplate>
 
                        </telerikControls:RadComboBox>
                    </DockPanel>
                    <Canvas Margin="4,0,0,0" Height="23" Width="23" Visibility="{Binding ActionerCount, Converter={StaticResource HiddenIfActionerDoesntExistConverter}, ConverterParameter=11}">
                        <Image Source="{StaticResource PMActionerRectangle}" Height="23" Width="23" Panel.ZIndex="100"/>
                        <Rectangle Height="21" Width="21" Margin="1,1,0,0" RadiusX="3" RadiusY="3" Panel.ZIndex="99">
                            <Rectangle.Fill>
                                <SolidColorBrush Color="{Binding SelectedColor, UpdateSourceTrigger=PropertyChanged,  Converter={StaticResource ColourConverter}}" />
                            </Rectangle.Fill>
                        </Rectangle>
                    </Canvas>
 
 
                </StackPanel>
            </Grid>
        </StackPanel>
    </Grid>

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 09 May 2011, 12:43 PM
Hi kevin,

This cannot be achieved out of the box. However, you can use the MouseLeftButtonDown events of the controls that are placed in the ItemTemplate of the RadTreeView and programmatically select the RadTreeViewItem. You can use the ParentOfType<> extension method in the Telerik.Windows.Controls assembly. Let us know if you need further assistance on this.

Best wishes,
Petar Mladenov
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
Kevin
Top achievements
Rank 2
Answers by
Petar Mladenov
Telerik team
Share this question
or