Hello
in my window I have buttons for load and save methods. I use CommandBinding and the save-button has a CanExecute property to keep the user from saving the data before it is loaded.
The CanExecute-Methode is connected to a simple bool value called "canSaveXML"
private void Save_CanExecute(object sender, CanExecuteRoutedEventArgs...
I've got the following xaml:
<Window x:Class="Isolator.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Isolator" Height="394" Width="486" Background="Black" WindowStyle="None" WindowState="Maximized">
<Window.CommandBindings>
...
Using WPF, I am building a very simple document editor that will provide basic formatting capabilities such as the ability to modify the appearance of a user's text, i.e. underline, bold, change font size, etc.
I have implemented several RichTextBox for the user's inputs and would like to display a button illustrating the toggle state o...
Hi, I am binding my command like:
<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
Here, I also bind its CommandParameter property, now how to fetch its value from NextCommand.
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
...
Question:
How do send data to a view model when using command binding? So that, for example, when i click a button, it sends the "currently selected index" of a list so that it can perform an operation on that item of the list
Further Information:
I'm working on a program where i have a list of shipments, and each shipment has a li...
I handle commands inside a RoutedCommand class that implements RoutedUICommand. This would help me to block or override a command by checking their CanExecute and Execute if needed. I can override EditingCommand, ApplicationCommand, etc.. One of the command that I cannot even handle is Ctr + Spacebar. Is it a MediaCommand or some other t...
When i create a user control that has a CommandBinding to a RoutedUICommand im worried that i get memory leaks.
scenario:
Have a RoutedUICommand as a static in c class where i store my commands
Implement the CommandBindings on a user control.
Add the user control to the main form.
Remove the user control from the main form, set the re...
I have a related question here where i have a user control with a command binding. The user control has being removed from the visual tree, yet the canExecute is still firing. My understanding of the Commanding model was that it bubbles and tunnels like routed events. So how can the CanExecute fire once the element with the command bindi...
Hi !
I want to bind the MouseDoubleClick (or PreviewMouseDoubleClick) to my custom Command defined in my custom WPF Control.
The problem is that it does not work.
...
<Popup>
...
<!--This CommandBinding **DOES NOT WORK** !-->
<ListBox Grid.Row="1"
x:Name="PART_lBox" ...
In my WPF application I have a TextBox and a Button. The button has a command binding to a command that will do something with the text.
<TextBox x:Name="_textBox"></TextBox>
<Button Command="{Binding SomeCommand}"
CommandParameter="{Binding ElementName=_text, Path=Text}"
Content="Trigger SomeCommand" />
Now, I want ...
My Application layer uses DialogPresenters to show some ViewModels in various dialogs (modal, splash screen, etc..).
public DataImportDialogPresenter(DataImportViewModel viewModel, IDialogView shellView, IDialogView owner)
: base(viewModel, shellView, owner)
{
//Base sets the view data context etc.
//Moni...
I have a UserControl that adds a CommandBinding to it's CommandBindings collection to handle a specific Command. Later I use this control in a window and want to add another binding to that same control to add additional behavior. The problem though, is that when I do this it seems that when I add another CommandBinding to the CommandBin...
I have a ToggleButton. I'm using a command binding, and I want to pass the value of its IsChecked property as a parameter. How can I do this without naming the ToggleButton and using its name to address itself?
Currently I'm solving this by naming the control, but I assume this can be done a better way?
<ToggleButton x:Name="_myToggl...
Im deriving from a third party control. It is implementing ApplicationCommands.SelectAll. However the behaviour i want is slightly different. there is no virtual method i can override, and when i register a class handler, like so
CommandManager.RegisterClassCommandBinding(typeof(MyDerivedControl), new CommandBinding(ApplicationComm...
I have a command binding on the main form of my application. It is used to open details of the item that i am viewing. It has an associated keyboard shortcut.
When i use the command in sub-forms i pass the object i want to open details for as a CommandParameter. This works if i attach the command to a button or a context menu, as i can ...
I've done a Custom Control in form of a GroupBox but with an extra header which purpose is to hold a button or a stackpanel with buttons at the other side.
I've added the a Dependency Property to hold the extra header and I've connected the customized template.
Everything works fine until I put one of these controls in another one. Now...
Hi, well this is driving me crazy. We have a command like so:
<CommandBinding Command="ApplicationCommands.Paste" CanExecute="HasClipboardData" Executed="OnPasteExecuted"/>
And the code for OnPasteExecuted is this:
private void OnPasteExecuted(object sender, ExecutedRoutedEventArgs e)
{
CurrentView.Paste();
e.Handled = true;
...
I have a scenario where in my custom control I have a custom Dependency Property called MinValue of type int.
I want to allow the user to change that value via keyboard input Ctrl++ (increase) and Ctrl+- (decrease). I undertand this can be done with Commands, but am clueless as to where to implement those Commands.
The user should be a...
Hi,
I am having a custom canvas derived from Canvas. It contains few ApplicationCommands like New/Open/Save etc. added like this -
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.New, New_Executed,
New_Enabled));
New_Enabled always returns true.
This control is used in a wpf project having a menu bar; New/Open/Save ...
All I wanted was different bindings on different tabs, so switching tabs would toggle command availability. I thought CommandBindings worked that way.
But I've spent the last while trying to get this simple sample to work. Either I fundamentally misunderstand (and that would not be a first) or something's wrong.
I add a CommandBinding...