0
<Grid Margin="3,0,3,3">

            <Grid>
                <Grid.RowDefinitions>                 
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>               
                <DockPanel Grid.Row="0">
                    <Image Source="/Images/Search.ico" Height="20" Width="20" DockPanel.Dock="Right"></Image>
                    <dxe:TextEdit ValidateOnTextInput="True" EditValueChanged="TextEdit_EditValueChanged"/>
                </DockPanel>
                <ListBox Name="ShortName_ListBox" Grid.Row="1" BorderThickness="0" VirtualizingPanel.IsVirtualizing="True" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" MouseLeftButtonDown="ListBox_Selection"  Cursor="Hand"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>

    </Grid> 

Here is my code. I successfully getting my result when I click on TextBlock(When Hand cursor appear)in ListBox.But when ListBoxItem is selected without touching to TextBlock only touch to the border of ListBoxItem it make that item selected but MouseLeftButtonDown not called. I want that if user not click on TextBlock then selection of item should not happen.

Harsha Jumde
  • 165
  • 3
  • 13
  • There is something Strange in your last sentence : "I want that if user not click on TextBlock then selection of item should not happen." ( that is perfectly normal of course - please correct the sentence) – Emmanuel DURIN Nov 04 '15 at 08:43
  • Images will help. Your ListBox_Selection code will help to. – Jose Nov 04 '15 at 08:46
  • See the accepted answer at http://stackoverflow.com/questions/1398559/there-is-no-listbox-selectionmode-none-is-there-another-way-to-disable-select if you don't need selection – kirotab Nov 04 '15 at 08:47
  • "I want that if user not click on TextBlock then selection of item should not happen." This is really strange .But When I taking cursor near to ListBoxItem it focus Item and in that condition I try to click it select that Item in this case touch to TextBlock not happen and event also not get execute – Harsha Jumde Nov 04 '15 at 08:54

0 Answers0