当前位置:网站首页 / WPF / 正文

【ay wpf markup】AY XAML应该这样玩-for循环【4/18】

时间:2016年07月21日 | 作者 : aaronyang | 分类 : WPF | 浏览: 1902次 | 评论 0


====================www.ayjs.net       杨洋    wpfui.com        ayui      ay  aaronyang=======请不要转载谢谢了。=========

DEMO10

<Button Content="Standard For">
                <p:Attached.Operations>
                    <p:EventHandler Path="Click">
                        <p:For Var="$i" TypePath="[Int32]">
                            <p:For.Value>
                                <p:Path>0</p:Path>
                            </p:For.Value>
                            <p:For.While>
                                <p:Path>$i @lt 3</p:Path>
                            </p:For.While>
                            <p:For.Next>
                                <p:Path>$i++</p:Path>
                            </p:For.Next>
                            <p:Call Path="[MessageBox].Show">
                                <p:Call Path="[String].Format">
                                    <p:Path>'i = {0}'</p:Path>
                                    <p:Path>$i</p:Path>
                                </p:Call>
                            </p:Call>
                        </p:For>
                    </p:EventHandler>
                </p:Attached.Operations>
            </Button>

第二种写法

   <Button Content="Simplied For">
                <p:Attached.Operations>
                    <p:EventHandler Path="Click">
                        <p:For Var="$i" Value="0" UpperLimit="3" Increment="1">
                            <p:Call Path="[MessageBox].Show">
                                <p:Call Path="[String].Format">
                                    <p:Path>'i = {0}'</p:Path>
                                    <p:Path>$i</p:Path>
                                </p:Call>
                            </p:Call>
                        </p:For>
                    </p:EventHandler>
                </p:Attached.Operations>
            </Button>

效果演示如下:

2.gif



====================www.ayjs.net       杨洋    wpfui.com        ayui      ay  aaronyang=======请不要转载谢谢了。=========




推荐您阅读更多有关于“WPF4.5,”的文章

猜你喜欢

额 本文暂时没人评论 来添加一个吧

发表评论

必填

选填

选填

必填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

  查看权限

抖音:wpfui 工作wpf

目前在合肥企迈科技公司上班,加我QQ私聊

2023年11月网站停运,将搬到CSDN上

AYUI8全源码 Github地址:前往获取

杨洋(AaronYang简称AY,安徽六安人)AY唯一QQ:875556003和AY交流

高中学历,2010年开始web开发,2015年1月17日开始学习WPF

声明:AYUI7个人与商用免费,源码可购买。部分DEMO不免费

查看捐赠

AYUI7.X MVC教程 更新如下:

第一课 第二课 程序加密教程

标签列表