简体   繁体   English

如何在Windows Phone中使用C#在列表框中显示完整数据

[英]how to show complete data in listbox using c# for windows phone

I am developing an app where i need to show data from web service in a listbox. 我正在开发一个需要在列表框中显示来自Web服务的数据的应用程序。 I am able to show data in my listbox but its not showing the complete data. 我可以在列表框中显示数据,但不能显示完整的数据。 There is some problem on managing the width of my box which i am not able to fix. 管理我无法修复的盒子宽度时出现一些问题。 Can anyone please help. 谁能帮忙。 Here is the code: 这是代码:

 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
       <ScrollViewer Margin="0,17,0,49" VerticalScrollBarVisibility ="Visible"  AllowDrop="False" ManipulationMode="Control">
            <ListBox Name="listBox1" Margin="68,106,58,662">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Button Width="300"  Height="120">
                            <Button.Content>
                                <StackPanel Orientation="Horizontal" Height="80" Width="80" Margin="0,0,0,0">
                                    <StackPanel Orientation="Vertical" Height="80">
                                    <TextBlock Text="{Binding Path=News_Title}" TextWrapping="Wrap" ></TextBlock>
                                        <TextBlock Text="{Binding Path=News_Description}" TextWrapping="Wrap"></TextBlock>
                                        <TextBlock Text="{Binding Path=Date_Start}" TextWrapping="Wrap"></TextBlock>

                                    </StackPanel>
                            </StackPanel>
                            </Button.Content>
                        </Button>
                </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>
    </Grid>

Everything is fine here, just few things were making the code messy, I have fixed them. 这里一切都很好,只有几件事使代码混乱,我已修复了它们。

See the updated grid now :) 现在查看更新后的表格:)

 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">


            <ListBox Name="listBox1">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Button>
                            <Button.Content>
                            <ScrollViewer HorizontalScrollBarVisibility="Auto" Height="80" Width="400">
                                <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
                                    <StackPanel Orientation="Vertical" Height="80">
                                        <TextBlock Text="{Binding Path=News_Title}" TextWrapping="Wrap" ></TextBlock>
                                        <TextBlock Text="{Binding Path=News_Description}" TextWrapping="Wrap"></TextBlock>
                                        <TextBlock Text="{Binding Path=Date_Start}" TextWrapping="Wrap"></TextBlock>

                                    </StackPanel>
                                </StackPanel>
                            </ScrollViewer>
                        </Button.Content>
                        </Button>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

    </Grid>

Check this, it would help :) 检查这个,将有所帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM