1

While setting datatype for data template in listview UWP I'm facing this issue

"Severity Code Description Project File Line Suppression State Error XDG0008 The name "Data" does not exist in the namespace "using:datasample".

Note:I have added namespace but doesn't work

xmlns:data="using:datasample"

<ListView x:Name="listView" HorizontalAlignment="Center">
        <ListView.ItemTemplate>
            <DataTemplate x:DataType="data:Datasam">
                <Grid Windows10FallCreatorsUpdate:ColumnSpacing="50">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="6*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Image Width="20" Height="20" Grid.Column="0" Source="/Assets/Icons/applogo.png"/>
                    <StackPanel Orientation="Vertical" Grid.Column="1">
                        <TextBlock Text="{Binding name}" Foreground="White" FontWeight="Bold"/>
                        <TextBlock Text="{Binding description}"/>
                    </StackPanel>
                    <StackPanel Windows10FallCreatorsUpdate:Spacing="15" Grid.Column="2" Orientation="Vertical">
                        <TextBlock Text="{Binding creatdate}"/>
                        <StackPanel Orientation="Horizontal" Windows10FallCreatorsUpdate:Spacing="10">
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

How to solve this.

2 Answers 2

1

In my case I have used spacing inside the Grid in DataTemplate, when i removed that, it works

<ListView x:Name="listView" HorizontalAlignment="Center">
        <ListView.ItemTemplate>
            <DataTemplate x:DataType="data:Datasam">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="6*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Image Width="20" Height="20" Grid.Column="0" Source="/Assets/Icons/applogo.png"/>
                    <StackPanel Orientation="Vertical" Grid.Column="1">
                        <TextBlock Text="{Binding name}" Foreground="White" FontWeight="Bold"/>
                        <TextBlock Text="{Binding description}"/>
                    </StackPanel>
                    <StackPanel Grid.Column="2" Orientation="Vertical">
                        <TextBlock Text="{Binding creatdate}"/>
                        <StackPanel Orientation="Horizontal">
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                            <Image Width="20" Height="20" Source="/Assets/Icons/applogo.png"/>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
0

Build whole your project (Build -> Build Solution) if it isn't work turn off vs at few minutes then open your project

If it isn't work 😅😅, use "local" instead of data that you describe it above then build your project

1
  • 1
    nothing worked in my case,i have posted my answer below
    – Nandha
    Commented Feb 5, 2019 at 13:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.