锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品专区久久,国产免费a∨片在线观看不卡,精品国产第一区二区三区观看体验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鍦╒iewModel閲屽浣曡幏寰楄View閲屾煇鎺т歡鐨勫紩鐢?/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[涓ょ偣錛?br />①錛氱粰璇ユ帶浠惰搗涓钁╃偣鐨勫悕瀛楋紙鐩殑鏄笉瑕佷笌鍒殑鎺т歡閲嶅悕錛?br />②錛氬彨閱掍綘鐨勬帶浠訛紝瀵癸紝瀹冨氨鐫″湪<span style="font-size: 13px; background-color: #eeeeee;">Application.Current.Windows</span>閲岋紒<br />娉細璇ユ柟娉曟潃浼ゅ姏宸ㄥぇ錛屾湁鎮朚VVM璁捐鍒濊》錛屽簲灝介噺閬垮紑<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鈥斺斿幓鍒楀ご錛屽幓楂樹寒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涓夊厔寮熲斺擲electedItem,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涓婇亣鍒頒簡鐗涢煎搫鍝勭殑 Chris Anderson
涓嬮潰鎴戜滑鏉ョ湅鐪嬬墰浜烘槸鎬庢牱鐏溂閲戠潧璇嗙牬榪欎笁涓縐樺浼欑殑錛?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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 榆林市| 周至县| 盐津县| 海丰县| 宁国市| 长治市| 泗水县| 永登县| 兴城市| 全南县| 灵川县| 苍溪县| 化德县| 沿河| 西昌市| 陇西县| 靖远县| 息烽县| 双峰县| 尚志市| 靖宇县| 满洲里市| 徐水县| 洪雅县| 尚义县| 罗平县| 淮阳县| 扎赉特旗| 天等县| 汾阳市| 黄冈市| 汉沽区| 安丘市| 巍山| 乌拉特中旗| 西盟| 吉木萨尔县| 鹰潭市| 灵山县| 康马县| 崇州市|