永发信息网

silverlight DataGrid 模板列头相关问题

答案:1  悬赏:0  手机版
解决时间 2021-04-24 06:04


    <Style TargetType="dataprimitives:DataGridColumnHeader">
                                                        <Setter Property="ContentTemplate">
                                                            <Setter.Value>
                                                                <DataTemplate>
                                                                    <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                                                        <Border BorderThickness="0,0,0,1" BorderBrush="White">
                                                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                                <TextBlock Text="登录客户数" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                                            </StackPanel>
                                                                        </Border>
                                                                        <StackPanel Orientation="Horizontal" >
                                                                            <Rectangle Fill="White" VerticalAlignment="Stretch" Width="1" />
                                                                            <TextBlock Text="" Margin="2,0,0,0" Width="98" />
                                                                            <Rectangle Fill="White" VerticalAlignment="Stretch" Width="1" />
                                                                            <TextBlock Text=" 2009 " Margin="2,0,0,0" Width="98" x:Name="txt_today"/>
                                                                            <Rectangle Fill="White" VerticalAlignment="Stretch" Width="1" />
                                                                            <TextBlock Text=" 环比 " Margin="2,0,0,0" Width="98"/>
                                                                            <Rectangle Fill="White" VerticalAlignment="Stretch" Width="1" />
                                                                            <TextBlock Text=" 同比 " Margin="2,0,0,0" Width="95"/>
                                                                            <Rectangle Fill="White" VerticalAlignment="Stretch" Width="1" />
                                                                        </StackPanel>
                                                                    </StackPanel>
                                                                </DataTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>

以上为xaml代码,如何在后台给 x:Name="txt_lastYear"的控件设置当前年份值,当然前台绑定的话也可以,求达人解答

最佳答案

1.给你绑定的实体添加一个LastYear的属性


2.若数据库表里无LastYear的值(意味着你要自动生成),绑定的时候用Converter转换,然后写一个Converter条件判断并返回当年的年份值。

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
如何看一个人睿智,还是愚笨?
饮酒醉酒驾驶机动车有什么危害
四川省规定的艺术生文化合格线是多少?
构成物质的基本粒子的有哪些?
为什么湖南邵东在殡葬改革的问题上 还没有起
男人为什么一定要娶处女做老婆?
什么样的朋友值得用一生铭记??
为什么我喜欢哄着我的男生 肉麻的男生 爱说情
HQ.VHS
山东广播电视大学周村学院地址在哪,我要去那
你好 我想请问一下你
4g的碳在8g的氧气中充分燃烧后,生成二氧化碳
某校学生人数,低中年级比总人数的2/3少15人
桂林最近温度怎么样?
女人为什么天生爱美呢?男人为什么会经不住女
推荐资讯
为什么我们学会游泳自行车就不会忘记,但是太
我要开个网店 明白的指点指点
小芳化妆美甲地址在什么地方,想过去办事
怎样才能使我不在内向?
08版手机QQ怎么看好友是不是拿手机登陆的?
武艺是靠长相,还是凭实力?
大Q吧 怎么改装速度最快
谁知道这个熊熊﹖
常喝绿茶能减肥吗,请问每天喝绿茶能减肥吗?
有谁知道手机宠物跨栏如何得到第一
我的电脑在组装三星的以前看电影还好今天为什
皇帝庙乡商桥村卫生所这个地址在什么地方,我
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?