有ListBox
與幾個項目。選擇任何項目(比如v.first項目),並保持嘗試拖動它在空白區域(列表框外),ListBox
選擇正在改變。雖然我在ListBox
以外的區域移動鼠標。當將鼠標移出列表框時,自動列表框選擇/ SelectedItem/SelectedIndex發生變化
我只希望在ListBox
內移動鼠標時選擇更改。或者在鼠標移動(拖拽)時完全禁用選擇更改。這是一個小型poc的快照。
<Grid>
<ListBox HorizontalAlignment="Left" Margin="111,49,0,180" Name="listBox1" Width="154">
<ListBoxItem BorderThickness="2" Height="50" Width="Auto" Name="heig" BorderBrush="Chocolate">Rohit Item 1</ListBoxItem>
<ListBoxItem Height="50" BorderThickness="2" BorderBrush="Blue" >Vivek</ListBoxItem>
<ListBoxItem Height="50" BorderBrush="Cyan" BorderThickness="2" >Gaurav</ListBoxItem>
<ListBoxItem Name="height" Height="50" BorderBrush="CornflowerBlue" BorderThickness="2" >Asit Item 2</ListBoxItem>
</ListBox>
</Grid>`
你可以發佈一些xaml代碼? – 2011-04-15 11:02:19