User (Old forums)MemberJanuary 19, 2008 at 8:44 pmPost count: 23064
My first post here, so “hello everybody” !
Let´s sav I have a UserControl with the Datagrid as one of many controls on it. That UserControl has some CommandBindings and listens to the CanExecute Events of the CommandBindings.
Unfortunately the CanExecute event does not fire when interacting with the grid. Let´s say the selected Row changed: No CanExecute Event.
If I click a TextBox on the UserControl: CanExecute Event fires.
The focus gets back to the grid: It does not fire 🙁
Can anybody help me? I really need to control my commands according to the selected rows in the grid!
Pleas ask if anything is unclear due to my english!
Imported from legacy forums. Posted by Christian (had 3378 views)User (Old forums)MemberJanuary 23, 2008 at 9:26 amPost count: 23064
I confirmed this problem as well. It’s a real nagging issue but I can’t reproduce it in a small case. It would be nice if you can create a repro case.
Imported from legacy forums. Posted by nat (had 444 views)User (Old forums)MemberJanuary 24, 2008 at 5:25 pmPost count: 23064
I just tried to create a very simple Repro case but it worked there… But I will go one trying…
Imported from legacy forums. Posted by Christian (had 346 views)User (Old forums)MemberJanuary 24, 2008 at 8:42 pmPost count: 23064
Ok. Here is one:
We have a MasterWindow with a Toolbar. That toolbar has a Button that triggers the Save Command. And there is a TextBox on the MainWindow.
<ToolBar Band=”1″ BandIndex=”1″>
<Button Command=”ApplicationCommands.Save” Content=”Command”/>
<TextBox Text=”UserControl loses Focus if you click me. The Command gets disabled”/>
As you see there is a UserControl too. That UserControl has a CommandBinding for the SaveCommand. And a TextBox and the GridControl.
— xaml: —
<CommandBinding Command=”ApplicationCommands.Save” CanExecute=”CommandBinding_CanExecute”/>
<TextBox Text=”My Focus triggers CanExecute” Margin=”10″/>
<xcdg:DataGridControl Name=”Grid” Grid.Row=”1″ Margin=”10″ />
— cs: —
Grid.ItemsSource = “My does not”;
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
e.CanExecute = true;
if you run this you´ll see my Problem:
If you click the textbox on the mainwindow the command gets disabled, because the UserControl does not own the focus. That seems reasonable and is what I expected.
If you click the textbox in the UserControl the Command gets enabled. Great.
But if you click the Grid instead nothing happens…
Imported from legacy forums. Posted by Christian (had 686 views)
- You must be logged in to reply to this topic.