locked
how to remve listview items gap RRS feed

  • Question

  • hi

    i'm trying to create report page (something like image2) and i'm trying to use ListView which allows me easily add/remove table rows and also allows to use table rows as custom control.

    the problem is listview items alway separated by little vertical space (imgae1), 

    my question is how to get rid of this space?

    Saturday, May 9, 2020 3:41 PM

All replies

  • Hi essamce,

    Thank you for posting here.

    According to your description, I need more information to make a test.

    >>the problem is listview items alway separated by little vertical space (imgae1)

    Could you provide some related code or a little sample here? It will help us to analzye and reproduce your problem.

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 11, 2020 1:45 AM
  • hi @Xingyu

    thanks for help,

    here is the code;

    Window
        x:Class="WpfCore.temp1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfCore"
        mc:Ignorable="d"
        Title="temp1"
        Height="450"
        Width="800">
    
        <Grid>
            <ListView
                x:Name="listView1"
                Margin="0"
                Padding="0"
                AllowDrop="False">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="100" />
                            </Grid.ColumnDefinitions>
                            <TextBox
                                Grid.Column="0"
                                BorderThickness="1,0,0,1"
                                BorderBrush="Black"/>
                            <TextBox
                                Grid.Column="1"
                                BorderThickness="1,0,0,1"
                                BorderBrush="Black"/>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Grid>
    </Window>
    using System.Collections.Generic;
    using System.Windows;
    
    namespace WpfCore
    {
        /// <summary>
        /// Interaction logic for temp1.xaml
        /// </summary>
        public partial class temp1 : Window
        {
            List<int> list1 = new List<int> { 2, 33, 44, 44 };
    
            public temp1()
            {
                InitializeComponent();
    
                this.listView1.ItemsSource = list1;
            }
        }
    }



    • Edited by essamce Monday, May 11, 2020 2:41 AM
    Monday, May 11, 2020 2:38 AM
  • Hi essamce,

    Thanks for your feedback.

    I note that your question is more related to WPF, so in order to get more efficient responses, I suggest that you can consider posting your question in WPF forum.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 11, 2020 2:57 AM