如何摆脱Windows Phone中动态创建的数据透视表中的pivotitems标题文本 [英] How to get rid of the pivotitems header text in a dynamically created pivot in windows phone

查看:108
本文介绍了如何摆脱Windows Phone中动态创建的数据透视表中的pivotitems标题文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个动态数据透视表,我使用列表绑定添加了pivotitems我的代码是这样的。





I have created a dynamic pivot in which i am adding the pivotitems using a list binding my code is like this.


<phone:Pivot x:Name="pvtDeals" Background="Gray" itemsSource="{Binding CityList}" >
             <phone:Pivot.ItemTemplate>
                    <DataTemplate>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="200"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Image x:Name="imgDeal" Tag="0" Source="{Binding ImageLink}" Stretch="Uniform" HorizontalAlignment="Stretch" Tap="imgDeal_Tap" />
                            <TextBlock Foreground="Red" Text="{Binding Title}" Grid.Row="1" TextWrapping="Wrap"/>
                            <ScrollViewer Grid.Row="2">
                                <TextBlock Foreground="Black" Text="{Binding Description}" TextWrapping="Wrap" Grid.Row="2"/>
                            </ScrollViewer>
                        </Grid>
                    </DataTemplate>
                </phone:Pivot.ItemTemplate>
            </phone:Pivot>









我的问题是我获得的pivotitem标题为ApplicationName.Model.Cities



这里的Cities是一个模型下的类,其属性在数据透视表中绑定。



如何摆脱pivotitems的标题文本或者mak它只是城市

请帮助





What exactly my problem is that I am getting pivotitem headers as ApplicationName.Model.Cities

Here Cities is a class under model with properties that are binded in the pivot.

How do I get rid of the header text of pivotitems or make it Just Cities
Please help

推荐答案

您可以在.cs文件中创建Appname.model.cities的实例当前的xaml代码。



类似于:var cities = new ApplicationName.Model.Cities()



然后设置pvtDeals.ItemSource = cities。{从ApplicationName.Model.Cities类返回城市列表的实例或变量}
You could create an instance of the Appname.model.cities in the .cs file of the current xaml code.

something like: var cities = new ApplicationName.Model.Cities()

then set the pvtDeals.ItemSource = cities.{instance or variable that returns a list of the cities from the ApplicationName.Model.Cities class}


这篇关于如何摆脱Windows Phone中动态创建的数据透视表中的pivotitems标题文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆