ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>麻豆av电影在线观看,日韩精品黄色网,亚洲视频在线一区观看http://blogjava.net/crazycoding/category/54847.htmlGod helps those who help themselves. zh-cnMon, 04 Jan 2016 22:53:25 GMTMon, 04 Jan 2016 22:53:25 GMT60在ViewModel里如何获得该View里某控äšg的引ç”?/title><link>http://www.aygfsteel.com/crazycoding/archive/2015/06/19/425793.html</link><dc:creator>Ying-er</dc:creator><author>Ying-er</author><pubDate>Fri, 19 Jun 2015 04:24:00 GMT</pubDate><guid>http://www.aygfsteel.com/crazycoding/archive/2015/06/19/425793.html</guid><wfw:comment>http://www.aygfsteel.com/crazycoding/comments/425793.html</wfw:comment><comments>http://www.aygfsteel.com/crazycoding/archive/2015/06/19/425793.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/crazycoding/comments/commentRss/425793.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/crazycoding/services/trackbacks/425793.html</trackback:ping><description><![CDATA[两点åQ?br />①åQšç»™è¯¥æŽ§ä»¶è“v个奇葩点的名字(目的是不要与别的控äšg重名åQ?br />②åQšå«é†’你的控ä»Óž¼Œå¯¹ï¼Œå®ƒå°±ç¡åœ¨<span style="font-size: 13px; background-color: #eeeeee;">Application.Current.Windows</span>里!<br />注:该方法杀伤力巨大åQŒæœ‰æ‚(zh¨¨n)–MVVM设计初衷åQŒåº”ž®½é‡é¿å¼€<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">                         </span><span style="color: #0000ff; background-color: yellow;">foreach</span><span style="background-color: yellow;"> (Window win </span><span style="color: #0000ff; background-color: yellow;">in</span><span style="background-color: yellow;"> Application.Current.Windows)</span><br />                        {<br />                            <span style="background-color: yellow;">dataGrid </span><span style="background-color: yellow;">=</span><span style="background-color: yellow;"> win.FindName(</span><span style="background-color: yellow;">"</span><span style="background-color: yellow;">_vwMarkDatagrid</span><span style="background-color: yellow;">"</span><span style="background-color: yellow;">) </span><span style="color: #0000ff; background-color: yellow;">as</span><span style="background-color: yellow;"> DataGrid;</span><br />                            <span style="color: #0000FF; ">if</span> (dataGrid != <span style="color: #0000FF; ">null</span> && selectMark.MarkID != currentMarkID)<br />                            {<br />                                isFromMap = <span style="color: #0000FF; ">true</span>;<br />                                currentMarkID = selectMark.MarkID;<br />                                <span style="background-color: #ffff99;">dataGrid.SelectedItem </span><span style="background-color: #ffff99;">=</span><span style="background-color: #ffff99;"> selectMark;</span><br />                                <span style="background-color: #ffff99;">dataGrid.ScrollIntoView(selectMark);</span><br /><br />                                <span style="color: #0000FF; ">break</span>;<br />                            }<br />                        }</div><img src ="http://www.aygfsteel.com/crazycoding/aggbug/425793.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/crazycoding/" target="_blank">Ying-er</a> 2015-06-19 12:24 <a href="http://www.aygfsteel.com/crazycoding/archive/2015/06/19/425793.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WPF 如何假装不是ListView——去列头åQŒåŽ»é«˜äº®http://www.aygfsteel.com/crazycoding/archive/2015/06/11/425614.htmlYing-erYing-erThu, 11 Jun 2015 03:08:00 GMThttp://www.aygfsteel.com/crazycoding/archive/2015/06/11/425614.htmlhttp://www.aygfsteel.com/crazycoding/comments/425614.htmlhttp://www.aygfsteel.com/crazycoding/archive/2015/06/11/425614.html#Feedback0http://www.aygfsteel.com/crazycoding/comments/commentRss/425614.htmlhttp://www.aygfsteel.com/crazycoding/services/trackbacks/425614.html                            <!--hide the header at the top of each grid column-->
                            <ListView.Resources>
                                <Style TargetType="GridViewColumnHeader">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Style>
                            </ListView.Resources>
                            <!--Remove highlight effect from ListViewItem-->
                            <ListView.ItemContainerStyle>
                                <Style TargetType="{x:Type ListViewItem}">
                                    <Setter Property="Background" Value="Transparent" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type ListViewItem}">
                                                <Border BorderBrush="Transparent" 
                                                                    BorderThickness
="0" 
                                                                    Background
="{TemplateBinding Background}">
                                                    <GridViewRowPresenter 
                                                                    
HorizontalAlignment="Stretch" 
                                                                    VerticalAlignment
="{TemplateBinding VerticalContentAlignment}" 
                                                                    Width
="Auto" 
                                                                    Margin
="0,3,0,0" 
                                                                    Content
="{TemplateBinding Content}"/>
                                                </Border>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListView.ItemContainerStyle>

Ying-er 2015-06-11 11:08 发表评论
]]>
说说WPF ListView里的selected三兄弟——SelectedItem,SelectedValue,SelectedValuePathhttp://www.aygfsteel.com/crazycoding/archive/2015/06/11/425613.htmlYing-erYing-erThu, 11 Jun 2015 02:55:00 GMThttp://www.aygfsteel.com/crazycoding/archive/2015/06/11/425613.htmlhttp://www.aygfsteel.com/crazycoding/comments/425613.htmlhttp://www.aygfsteel.com/crazycoding/archive/2015/06/11/425613.html#Feedback0http://www.aygfsteel.com/crazycoding/comments/commentRss/425613.htmlhttp://www.aygfsteel.com/crazycoding/services/trackbacks/425613.html只因在大名鼎鼎的stackoverflow上遇åˆîCº†ç‰›é€¼å“„å“„çš„ Chris Anderson
下面我们来看看牛人是怎样火眼金睛识破˜q™ä¸‰ä¸ªç¥ž¿U˜å®¶ä¼™çš„åQ?br />以下内容完全转自stackoverflow

Their names can be a bit confusing :). Here's a summary:

  • The SelectedItem property returns the entire object that your list is bound to. So say you've bound a list to a collection of Category objects (with each Category object having Name and ID properties). eg. ObservableCollection<Category>. The SelectedItem property will return you the currently selected Category object. For binding purposes however, this is not always what you want, as this only enables you to bind an entire Category object to the property that the list is bound to, not the value of a single property on that Category object (such as its ID property).

  • Therefore we have the SelectedValuePath property and the SelectedValue property as an alternative means of binding (you use them in conjunction with one another). Let's say you have aProduct object, that your view is bound to (with properties for things like ProductName, Weight, etc). Let's also say you have a CategoryID property on that Product object, and you want the user to be able to select a category for the product from a list of categories. You need the ID property of the Category object to be assigned to the CategoryID property on the Product object. This is where the SelectedValuePath and the SelectedValue properties come in. You specify that the ID property on the Category object should be assigned to the property on the Product object that the list is bound to using SelectedValuePath='ID', and then bind the SelectedValueproperty to the property on the DataContext (ie. the Product).

The example below demonstrates this. We have a ComboBox bound to a list of Categories (via ItemsSource). We're binding the CategoryID property on the Product as the selected value (using the SelectedValue property). We're relating this to the Category's ID property via the SelectedValuePath property. And we're saying only display the Name property in the ComboBox, with the DisplayMemberPath property).

<ComboBox ItemsSource="{Binding Categories}" 
          SelectedValue
="{Binding CategoryID, Mode=TwoWay}" 
          SelectedValuePath
="ID" 
          DisplayMemberPath
="Name" />

It's a little confusing initially, but hopefully this makes it a bit clearer... :)

Chris



















Ying-er 2015-06-11 10:55 发表评论
]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º ÓÀÐËÏØ| ãþÑôÏØ| ³à³ÇÏØ| ÈêÖÝÊÐ| ÑγØÏØ| »´±±ÊÐ| ÂÌ´ºÏØ| Î÷³ÇÇø| ºÚÁú½­Ê¡| ¹ÌÔ­ÊÐ| ¾ÅÁúÆÂÇø| ½­´ïÏØ| ÉäÑôÏØ| ÃÖÀÕÏØ| ÓÀ´¨ÊÐ| µ¤¶«ÊÐ| ÎäÒØÏØ| Ë«°ØÏØ| ½­É½ÊÐ| ½­½òÊÐ| ÇßË®ÏØ| Àè´¨ÏØ| ʯºÓ×ÓÊÐ| ×Ô¹±ÊÐ| ¶«ÁÉÏØ| ¹ÅÝþÏØ| ÆæÌ¨ÏØ| ÀúÊ·| ·áÏØ| ¶«ÏçÏØ| ÕÑÆ½ÏØ| »ªÒõÊÐ| Á¬É½| Ô«ÇúÏØ| ¸§ÄþÏØ| ÃçÀõÏØ| ÇÒÄ©ÏØ| °ÙÉ«ÊÐ| ËÉ×ÌÊÐ| ¶«ÑôÊÐ| ÇàÑôÏØ|