Note that there are some explanatory texts on larger screens.

plurals
  1. POCommand Binding with WPF
    primarykey
    data
    text
    <p>Im a complete Noob to this so im having a really hard time wrapping my head around how this works.</p> <p>Basically I have a Main Page that im using, and within the XAML i have created a menu</p> <p><br> </p> <p>What I have is a Document (DummyDoc) that contains a TextBox within it that i am trying to send the find command to.</p> <p>Ive tried this every which way and googled it but i just cant seem to get it to work for me and could use some help with a push in the right direction</p> <p>Main form</p> <pre><code> &lt;Window&gt; xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:i="clr-namespace:DMC_Robot_Editor" xmlns:local="clr-namespace:DMC_Robot_Editor.GUI" &lt;Menu&gt; &lt;MenuItem Header="_Edit"&gt; &lt;MenuItem Header="_Cut"/&gt; &lt;/MenuItem&gt; &lt;MenuItem/&gt; &lt;Grid&gt; &lt;local:DummyDoc x:Name="_Editor"/&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>That is the main form that i am using. then i have my second document "DummyDoc"</p> <pre><code>&lt;ad:DocumentContent x:Name="document" x:Class="DMC_Robot_Editor.Controls.DummyDoc" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" xmlns:local="clr-namespace:DMC_Robot_Editor.Controls" xmlns:ed="schemas.microsoft.com/expression/2010/drawing" Title="Window1" Height="300" Width="300" IsVisibleChanged="Is_VisibleChanged" PropertyChanged="document_PropertyChanged"&gt; &lt;Grid&gt; &lt;Menu &gt; &lt;MenuItem Header="_File"&gt; &lt;MenuItem Header="was here"/&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;local:Editor x:Name="source" IsVisibleChanged="Is_VisibleChanged" TextChanged="TextChanged" UpdateFunctions="raiseupdated" /&gt; &lt;local:Editor x:Name="data" Visibility="Hidden" IsVisibleChanged="Is_VisibleChanged" TextChanged="TextChanged" UpdateFunctions="raiseupdated"/&gt; &lt;/Grid&gt; &lt;/ad:DocumentContent&gt; </code></pre> <p>DummyDoc is a window that has an Inherited Editor in it. </p> <pre><code>&lt;avalonedit:TextEditor xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" x:Class="DMC_Robot_Editor.Controls.Editor" x:Name="editor" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" TextChanged="Text_Changed" IsVisibleChanged="raiseUpdate" MouseMove="Mouse_Move" MouseHover="Mouse_Hover" MouseHoverStopped="Mouse_Hover_Stopped" KeyUp="editor_KeyUp"&gt; &lt;/avalonedit:TextEditor&gt; </code></pre> <p>My Ultimate Question is how do i use WPF Binding to make the "Cut" Action from the main form initiate the cut() method of the textbox?</p> <p>I wrote textbox in it because in code behind, im doing the following</p> <pre><code> partial class DummyDoc:DocumentContent { public Editor TextBox{get;set;} private void Is_VisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (sender is Editor) this.TextBox = sender as Editor; if ((VisibilityChanged != null) &amp;&amp; (TextBox != null)) raiseupdated(TextBox, new FunctionEventArgs(this.TextBox.Text)); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload