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

ListView not displaying the ItemTemplates correctly

3 Answers 447 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Sergio
Top achievements
Rank 1
Sergio asked on 24 Oct 2015, 12:57 PM

Hello,

I'm working with the ListView and I'm having some problems, I was wondering if I was just missing a simple Property to set or if there's some sort of problem with the control itself.

What's happening is that the ListView is adding some margins to the left and the right of the ItemTemplates (even though in the XAML designer I can see that the ListView itself covers the full width of the page), and is somehow scaling up the TextBlocks inside each template, so as a result the whole UI of the templates is messed up.

I attached a screen to show you the difference and result I'd like to get.

This is the code of the ListView:  

<telerik:RadListView EmptyContentDisplayMode="DataSourceEmpty"
              ItemsSource="{x:Bind ViewModel.ItemGroups, Mode=OneWay}"
              Padding="0"
              Margin="0"
              HorizontalAlignment="Stretch"
              HorizontalContentAlignment="Stretch"
              IsActionOnSwipeEnabled="False"
              IsCheckModeActive="False"
              IsDoubleTapEnabled="False"
              IsItemReorderEnabled="False"
              SelectionMode="None">
  <telerik:RadListView.LayoutDefinition>
    <telerikListView:StackLayoutDefinition/>
  </telerik:RadListView.LayoutDefinition>
  <telerik:RadListView.ListHeader>
    <Grid Height="48"/>
  </telerik:RadListView.ListHeader>
  <telerik:RadListView.EmptyContent>
    <TextBlock Text="This folder is empty :'("
            Margin="32,32,0,0"
            FontWeight="SemiLight"
            FontSize="20"
            Foreground="#FFD0D0D0"/>
  </telerik:RadListView.EmptyContent>
    <telerik:RadListView.ItemTemplate>
      <DataTemplate x:DataType="dataModels:ItemsGroupWithOptionalSectionModel">
        <templates:SectionedGroupTemplate/>
      </DataTemplate>
    </telerik:RadListView.ItemTemplate>
</telerik:RadListView>

 I already tried setting the Padding and the Margin properties to 0, or to set HorizontalAlignment="Stretch", but I didn't solve the issue.

 Is there a way to prevent the ListView to behave this way and to have it render its content without any type of modifications, just like a simple StackPanel?

 

Thank you in advance for your help.

Best regards,

Sergio

3 Answers, 1 is accepted

Sort by
0
Sergio
Top achievements
Rank 1
answered on 26 Oct 2015, 11:17 AM

EDIT: I had a similar problem with the new UWP ListView (I mean the built in ListView) and I managed to solve it, see the StackOverflow question here ListView item template

 I forgot to add that I also don't want any additional VisualStates, I want to be able to manually set everything within my templates. So I just want my RadListView to display the item templates with their original UI, without scaling anything, without any kind of visual states (pointer animations, background color changes on mouse over etc...) or other additional UI elements.

 

I mean, I just wish the new UWP RadListView worked like the RadDataBoundListBox in WP8.1, which displayed its content exactly as it was, without any visual state or modification.

I really like the ability to add custom item added/removed animations, the reorder mode and everything else, I just wish the items themselves were rendered without any visual change.

 

Thank you again for your help!

Sergio

0
Ivaylo Gergov
Telerik team
answered on 29 Oct 2015, 09:21 AM
Hello Sergio,

Sorry for the late response.

We will further investigate this and we will get back to you with more information.

I apologize for any inconvenience caused.

Regards,
Ivaylo Gergov
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
Sergio
Top achievements
Rank 1
answered on 29 Oct 2015, 06:39 PM

Hello Ivalyo,

no problems at all, thank you for your answer.

For the time being, I switched back to the default ListView, as I could edit the default ItemContainerStyle to achieve what I wanted. Here is the Style I came up with: it removes any VisualState on the contained items as well as other unwanted UI elements: http://pastebin.com/gwDZd1Ea

 

I was wondering whether it'd be possible to do something like that with the RadListView as well.

Anyways, I'm still using all your other controls in the app, so that's definitely not a problem and I'll keep working with your UWP library for sure :)

 

Best regards, have a nice day!

Sergio

 

Tags
ListView
Asked by
Sergio
Top achievements
Rank 1
Answers by
Sergio
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Share this question
or