77540 Cunt Bodysensualchicks Hr Song 573161 77540 I%27m Alive Body Sensual Chicks Windows Presentation Foundation (WPF)

Body Sensual Chicks

Cunt Bodysensualchicks Hr Song 573161 77540 I%27m Alive Body Sensual Chicks Windows Presentation Foundation (WPF)

Cunt Bodysensualchicks Hr Song 573161 77540 I%27m Alive Body Sensual Chicks

search search7search43 Song search3 Cunt Cunt 7search4 Cunt Bodysensualchicks searcho 573161 g 77540 5 I%27m 77540 7 573161 40 I%27m 2 573161 C Bodysensualchicks n 1 Song ear 77540 hsearcho Bodysensualchicks gsearch95 I%27m 7 573161 8 Alive _ Alive 573161 s Bodysensualchicks a 77540 ch Alive 77540 % Alive 7 Song Jun 19 2010 at 3:01 PM 
Since this took me a while to find if you want a ComboBox to drop down straight away hook up its loaded event and:

private void ComboBox_Loaded(object sender, RoutedEventArgs e)
{
((ComboBox)sender).IsDropDownOpen = true;
}

kainhart Jun 4 2010 at 12:51 AM 
I placed the style shown above in a new Style that I've defined in a resource dictionary but when I try to build I get the following error.

The event 'PreviewMouseLeftButtonDown' cannot be specified on a Target tag in a Style. Use an EventSetter instead.

Is this possible? I'm attempting to wrap the DataGrid up with a control that inherits from the WpfToolkit DataGrid so that I can add the functionality described here to a single control that I can reuse throughout different portions of my app.

gshaffer Mar 18 2010 at 9:18 PM 
The above code works great for me. I do have a question though. After the first click into a cell, is there a way to programmatically force input into the provided editor? For instance, if I have a combobox, I'd like for the combobox to be expanded when the user performs the first click. This would eliminate yet another click, which is important to my endusers.

sukumarthota Feb 24 2010 at 2:09 AM 
I got rid of above error by including style tag inside datagrid resources. Now I wanted to know how to save the edited value to database?

sukumarthota Feb 24 2010 at 2:04 AM 
I am getting this error when using singleclick code given above:
"itemcollection must be empty before using Itemsource". Can someone help here. Thanks.

htuomola Aug 7 2009 at 1:23 PM 
Hi, using this method alone seems to leave all the rows/cells selected.
Adding "dataGrid.SelectedItems.Clear();" after "if (dataGrid != null)" fixed the problem.

Borvik Feb 16 2009 at 5:30 PM 
I managed to find a way that suited my needs (reverse tabbing still doesn't work).

Here is one of my columns (I decided NO to textblocks - and have a single cell template):
<my:DataGridTemplateColumn Header="Item #">
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=ItemNumber}" />
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
</my:DataGridTemplateColumn>
I also have similar column for a CheckBox (I didn't like the built in column).

The changes a similar to the SingleClick:

<Style TargetType="{x:Type my:DataGridCell}">
<EventSetter Event="GotFocus" Handler="DataGridCell_GotFocus"></EventSetter>
</Style>


Private Sub DataGridCell_GotFocus(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
Dim cell As DataGridCell = CType(sender, DataGridCell)
Dim childTxt As TextBox = FindVisualChild(Of TextBox)(cell)
If childTxt IsNot Nothing Then
If Not childTxt.IsFocused Then
Keyboard.Focus(childTxt)
End If
Exit Sub
End If

Dim childChk As CheckBox = FindVisualChild(Of CheckBox)(cell)
If childChk IsNot Nothing Then
If Not childChk.IsFocused Then
Keyboard.Focus(childChk)
End If
Exit Sub
End If
End Sub

Private Shared Function FindVisualChild(Of T As UIElement)(ByVal element As UIElement) As T
Dim child As UIElement = element
While child IsNot Nothing
Dim correctlyTyped As T = TryCast(child, T)
If correctlyTyped IsNot Nothing Then Return correctlyTyped
If VisualTreeHelper.GetChildrenCount(child) < 1 Then Exit While
child = CType(VisualTreeHelper.GetChild(child, 0), UIElement)
End While
Return Nothing
End Function

You would have to modify the GotFocus event handler to suit your individual needs.

NetContractor Nov 16 2008 at 1:16 AM 
Is there an easy way to fix the tabbing through the grid? If I have template columns I seem to need to tab twice before getting the focus?

Sign in to add a comment
1013 people are following this project ()
Download