Click here to Skip to main content
15,909,242 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: How to add option (none) and (new) to itembinding combobox Pin
Pete O'Hanlon14-Dec-11 22:25
mvePete O'Hanlon14-Dec-11 22:25 
GeneralRe: How to add option (none) and (new) to itembinding combobox Pin
Loveisasea18-Dec-11 15:57
Loveisasea18-Dec-11 15:57 
GeneralRe: How to add option (none) and (new) to itembinding combobox Pin
Pete O'Hanlon18-Dec-11 19:36
mvePete O'Hanlon18-Dec-11 19:36 
AnswerRe: How to add option (none) and (new) to itembinding combobox Pin
Mycroft Holmes18-Dec-11 16:14
professionalMycroft Holmes18-Dec-11 16:14 
QuestionGetting binding expression out of a DataGridTemplateColumn's CellTemplate in code-behind Pin
Nicolai Schrade13-Dec-11 21:53
Nicolai Schrade13-Dec-11 21:53 
QuestionSub menu Pin
columbos1492712-Dec-11 3:47
columbos1492712-Dec-11 3:47 
AnswerRe: Sub menu Pin
Pete O'Hanlon12-Dec-11 4:04
mvePete O'Hanlon12-Dec-11 4:04 
QuestionHotkey Implementation Pin
gmeehan12-Dec-11 2:47
gmeehan12-Dec-11 2:47 
I've been a long time reader of this forum, and finally had a question I just couldn't figure out through any searches. So I signed up hoping someone would have an idea!

I am attempting to implement global hotkeys in my WPF data entry application. An example of a hotkey would be to hit F1 to save a record and move to the next record (no matter where the user has clicked, as long as it's inside the window).

Well, the functionality works correctly. When you hit F1, it saves the record. But only if you hit F1 twice. The first keypress (by observing the debugger) has an F1 KeyStates.Down value of "false". It is "true" the second time.

Here is what I've used XAML-side so far:

XML
<Window.CommandBindings>
        <CommandBinding Command="{x:Static my:MainWindow.CustomRoutedCommand}"
                    Executed="ExecutedCustomCommand"
                    CanExecute="CanExecuteCustomCommand" />
</Window.CommandBindings>


And code side:

Public Shared CustomRoutedCommand As New RoutedCommand()


VB
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

   'Initialize hotkeys
   Dim customCommandBinding As New CommandBinding(CustomRoutedCommand, AddressOf ExecutedCustomCommand)
   Dim saveKeyGesture As New KeyGesture(Key.F1)
   CustomRoutedCommand.InputGestures.Add(saveKeyGesture)

End Sub


VB
Public Sub ExecutedCustomCommand(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)

        If (Keyboard.GetKeyStates(Key.F1) = KeyStates.Down) Then 
            SaveRecord()
        End If

End Sub



Thanks!

-- Graham
QuestionBinding SL DataGrid column to looked up property value Pin
Ravi Bhavnani11-Dec-11 14:25
professionalRavi Bhavnani11-Dec-11 14:25 
AnswerRe: Binding SL DataGrid column to looked up property value Pin
Mycroft Holmes11-Dec-11 18:49
professionalMycroft Holmes11-Dec-11 18:49 
GeneralRe: Binding SL DataGrid column to looked up property value Pin
Ravi Bhavnani12-Dec-11 1:48
professionalRavi Bhavnani12-Dec-11 1:48 
GeneralRe: Binding SL DataGrid column to looked up property value Pin
Mycroft Holmes12-Dec-11 12:08
professionalMycroft Holmes12-Dec-11 12:08 
QuestionChanges made in visual studio do not show in browser Pin
don_biglia11-Dec-11 12:00
don_biglia11-Dec-11 12:00 
AnswerRe: Changes made in visual studio do not show in browser Pin
Abhinav S11-Dec-11 18:35
Abhinav S11-Dec-11 18:35 
GeneralRe: Changes made in visual studio do not show in browser Pin
don_biglia16-Dec-11 7:52
don_biglia16-Dec-11 7:52 
GeneralRe: Changes made in visual studio do not show in browser Pin
Saksida Bojan18-Dec-11 9:43
Saksida Bojan18-Dec-11 9:43 
QuestionError: Class not registered (Exception from HRESULT: 0x80040154) Pin
Mostafa Sabeti10-Dec-11 22:17
Mostafa Sabeti10-Dec-11 22:17 
AnswerRe: Error: Class not registered (Exception from HRESULT: 0x80040154) Pin
thatraja11-Dec-11 19:52
professionalthatraja11-Dec-11 19:52 
QuestionWPF Radio Button Group Behavior Pin
Eric Woodruff10-Dec-11 15:19
professionalEric Woodruff10-Dec-11 15:19 
AnswerRe: WPF Radio Button Group Behavior Pin
SledgeHammer0110-Dec-11 17:51
SledgeHammer0110-Dec-11 17:51 
Questionhow to hide particular grid. Pin
SRKSHOME9-Dec-11 5:41
SRKSHOME9-Dec-11 5:41 
AnswerRe: how to hide particular grid. Pin
Abhinav S9-Dec-11 23:15
Abhinav S9-Dec-11 23:15 
QuestionDataGrid databinding to List<> properties of an object Pin
Member 84745799-Dec-11 3:21
Member 84745799-Dec-11 3:21 
AnswerRe: DataGrid databinding to List properties of an object Pin
Wayne Gaylard9-Dec-11 5:17
professionalWayne Gaylard9-Dec-11 5:17 
QuestionDependencyProperty doesn't find items in Resource Dictionary Pin
Member 76693458-Dec-11 7:46
Member 76693458-Dec-11 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.