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

Row Selector's Column

4 Answers 132 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Joel Palmer
Top achievements
Rank 2
Joel Palmer asked on 14 Aug 2015, 03:25 PM

Space is premium on my TreeListView.  I removed the Row Selector but I still seem to have a column reserved for it.  Is there a way to set that column to zero width or eliminate it all together?

Thanks for your help,

Joel.

Data Templates:

<DataTemplate
    x:Key="TreeNodeTemplate">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
 
        <Image
            Grid.Column="0"
            Source="{Binding Image, Mode=TwoWay}"
            ToolTip="{Binding Barcode, Mode=TwoWay}"/>
 
        <Image
            Grid.Column="0"
            Height="20"
            Width="20"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            Margin="-20,0,0,0"
            Source="{Binding StatusImage, Mode=TwoWay}"
            ToolTip="{Binding StatusName, Mode=TwoWay}"/>
 
        <TextBlock
            Grid.Column="1"
            Text="{Binding Name, Mode=TwoWay}"
            Margin="5"
            ToolTip="{Binding Description}"/>
    </Grid>
</DataTemplate>
<DataTemplate
    x:Key="TreeNodeEditTemplate">
 
    <StackPanel
        Orientation="Horizontal">
 
        <StackPanel
            Orientation="Vertical">
 
            <Image
                Height="20"
                Width="20"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Source="{Binding StatusImage, Mode=TwoWay}"
                ToolTip="{Binding StatusName, Mode=TwoWay}"/>
 
            <Image
                Source="{Binding Image, Mode=TwoWay}"
                VerticalAlignment="Top"/>
        </StackPanel>
 
        <Grid
            Margin="5"
            Background="Cornsilk">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
 
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="125"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
 
                <Grid.RowDefinitions>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
 
                <Label
                    Content="ID:"
                    Grid.Column="0"
                    Grid.Row="0"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"/>
 
                <TextBlock
                    Grid.Column="1"
                    VerticalAlignment="Center"
                    Text="{Binding ID, Mode=TwoWay}"/>
 
                <Label
                    Content="Name:"
                    Grid.Column="0"
                    Grid.Row="1"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"/>
 
                <TextBox
                    Grid.Column="1"
                    Grid.Row="1"
                    VerticalAlignment="Center"
                    Text="{Binding Name, Mode=TwoWay}"
                    IsEnabled="{Binding IsEditableStatus}"
                    IsReadOnly="{Binding IsEditableStatus, Converter={StaticResource BoolToOppositeBoolConverter}}"/>
 
                <Label
                    Content="Description:"
                    Grid.Column="0"
                    Grid.Row="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"/>
 
                <TextBox
                    Grid.Column="1"
                    Grid.Row="2"
                    VerticalAlignment="Center"
                    Text="{Binding Description, Mode=TwoWay}"
                    IsEnabled="{Binding IsEditableStatus}"
                    IsReadOnly="{Binding IsEditableStatus, Converter={StaticResource BoolToOppositeBoolConverter}}"/>
 
                <Label
                    Content="Barcode:"
                    Grid.Column="0"
                    Grid.Row="3"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"/>
 
                <TextBox
                    Grid.Column="1"
                    Grid.Row="3"
                    VerticalAlignment="Center"
                    Text="{Binding Barcode, Mode=TwoWay}"/>
            </Grid>
 
            <GroupBox
                Header="Status"
                Grid.Row="4"
                Margin="5">
 
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="125"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
 
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="28"/>
                    </Grid.RowDefinitions>
 
                    <Label
                        Content="CRUD Status:"
                        Grid.Column="0"
                        Grid.Row="0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"/>
 
                    <TextBlock
                        Grid.Column="1"
                        Grid.Row="0"
                        VerticalAlignment="Center"
                        Text="{Binding StatusName, Mode=TwoWay}"/>
 
                    <Label
                        Content="Inspect Status:"
                        Grid.Column="0"
                        Grid.Row="1"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"/>
 
                    <TextBlock
                        Grid.Column="1"
                        Grid.Row="1"
                        Text="{Binding InspectStatusName, Mode=TwoWay}"
                        VerticalAlignment="Center"/>
                </Grid>
            </GroupBox>
 
        </Grid>
    </StackPanel>
</DataTemplate>

 

Control Configuration:

<telerik:RadTreeListView
    x:Name="treeListView"
    AutoGenerateColumns="False"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    CanUserFreezeColumns="False"
    CanUserReorderColumns="False"
    SelectionMode="Single"
    Grid.Row="1"
    Margin="5"
    IsReadOnly="{Binding IsReadOnly}"
    ItemsSource="{Binding Hierarchy, Mode=TwoWay}"
    SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
    IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}"
    AutoExpandItems="True"
    ShowGroupPanel="False"
    IsFilteringAllowed="False"
    ShowColumnHeaders="False"
    EditTriggers="F2"
    HierarchyIndent="12"
    MinColumnWidth="12"
    RowIndicatorVisibility="Hidden"
    MouseDoubleClick="treeListView_MouseDoubleClick"
    PreviewMouseLeftButtonDown="treeListView_PreviewMouseLeftButtonDown">
 
    <telerik:RadTreeListView.ChildTableDefinitions>
        <telerik:TreeListViewTableDefinition 
            ItemsSource="{Binding Children}"/>
    </telerik:RadTreeListView.ChildTableDefinitions>
    <telerik:RadTreeListView.Columns>
 
        <telerik:GridViewDataColumn
            DataMemberBinding="{Binding Name, Mode=TwoWay}"
            CellTemplate="{StaticResource TreeNodeTemplate}"
            CellEditTemplate="{StaticResource TreeNodeEditTemplate}"
            IsReadOnly="False"
            Width="*"/>
 
        <telerik:GridViewComboBoxColumn
            x:Name="itemTypeColumn"
            Header="Item Type"
            DataMemberBinding="{Binding ItemTypeID, Mode=TwoWay}"
            DisplayMemberPath="Name"
            SelectedValueMemberPath="ID"
            SortMemberPath="Order"
            SortingState="Ascending"
            ItemsSource="{Binding TypeModel.Items, Mode=TwoWay}"
            IsReadOnly="True"
            Width="150"/>
 
        <telerik:GridViewDataColumn
            DataMemberBinding="{Binding IsActive, Mode=TwoWay}"
            Header="Include"/>
 
    </telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>

4 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 14 Aug 2015, 03:30 PM
Hi Joel,

Can you please confirm what do you mean by mentioning "Row Selector"? A picture that illustrates the UI would be very helpful.

Regards,
Ivan Ivanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Joel Palmer
Top achievements
Rank 2
answered on 14 Aug 2015, 03:40 PM
See attached.  I gracefully tried to highlight the column.
0
Accepted
Vanya Pavlova
Telerik team
answered on 17 Aug 2015, 08:18 AM
Hi Joel,


The part you are trying to hide is the row indicator of each TreeListViewRow. RowIndicatorVisibility property of RadTreeListView set to Hidden cause this behavior.

Generally setting Visibility.Hidden hides the element, but reserves space in the layout.
Set this property to Collapsed and the border will disappear, you may check the following:

<telerik:RadTreeListView
    x:Name="treeListView"
    .....
    RowIndicatorVisibility="Collapsed"
    MouseDoubleClick="treeListView_MouseDoubleClick"
    PreviewMouseLeftButtonDown="treeListView_PreviewMouseLeftButtonDown">
</telerik:RadTreeListView>



Regards,
Vanya Pavlova
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Joel Palmer
Top achievements
Rank 2
answered on 19 Aug 2015, 05:18 PM
Awesome.  I love an easy fix.  Thanks for catching that.
Tags
TreeListView
Asked by
Joel Palmer
Top achievements
Rank 2
Answers by
Ivan Ivanov
Telerik team
Joel Palmer
Top achievements
Rank 2
Vanya Pavlova
Telerik team
Share this question
or