Click here to Skip to main content
15,889,992 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Generate decimal point automatically while entering in textbox in wpf Pin
Pete O'Hanlon1-Sep-10 23:07
mvePete O'Hanlon1-Sep-10 23:07 
AnswerRe: Generate decimal point automatically while entering in textbox in wpf Pin
V.2-Sep-10 20:16
professionalV.2-Sep-10 20:16 
GeneralRe: Generate decimal point automatically while entering in textbox in wpf Pin
Pete O'Hanlon2-Sep-10 22:38
mvePete O'Hanlon2-Sep-10 22:38 
GeneralRe: Generate decimal point automatically while entering in textbox in wpf Pin
V.2-Sep-10 22:47
professionalV.2-Sep-10 22:47 
QuestionTrying to bind to a dependency property [modified] Pin
Christian Graus1-Sep-10 19:26
protectorChristian Graus1-Sep-10 19:26 
AnswerRe: Trying to bind to a dependency property Pin
PumbaPumba27-Sep-10 7:53
PumbaPumba27-Sep-10 7:53 
QuestionFinding a Keybinding Pin
Drathmar1-Sep-10 10:36
Drathmar1-Sep-10 10:36 
QuestionAdding custom routed event of user control to xaml of a window in wpf Pin
dashingsidds1-Sep-10 5:04
dashingsidds1-Sep-10 5:04 
Hi Experts,

I am little new to Command binding so this might be a trivial question to many. I know that we can add Command bindings in xaml of a window and give its correspondng property in viewmodel. This viewmodel will be given to the DataContext of the window. Something like the following

--app.xaml.cs
mainWindow.DataContext = viewModel;


-- xaml
lt;Button Grid.Row="1" HorizontalAlignment="Right" Margin="0,3,18,3" Name="button1" Width="110" 
                Command="{Binding LoadCommand}">_Load</Button>


-- viewmodel
/// <summary>
        /// Gets the load command.
        /// </summary>
        /// <value>The load command.</value>
        public ICommand LoadCommand
        {
            get
            {
                if (m_LoadCommand == null)
                {
                    m_LoadCommand = new RelayCommand(param => CanLoad(), param => Load());
                }

                return m_LoadCommand;
            }
        }


Here the relaycommand is a class which implements ICommand interface. CanLoad() and Load() are the methods which will get executed for canexecute and execute action of the relaycommand respectively. This is the click event of the button which is handled.

I have a user control which has a custom routedevent registered in it and the user control is then used on a window. I am currently adding the event handler explicitly in code.

//hook up event listeners on the actual UserControl instance
            this.ucCustomEvent1.CustomClick += new RoutedEventHandler(ucCustomEvent_CustomClick);
            //hook up event listeners on the main window (Window1)
            this.AddHandler(UserControlThatCreatesEvent.CustomClickEvent, new RoutedEventHandler(ucCustomEvent_CustomClick));


I dont want to hook up the routedevent explicitly in code but in the xaml in the similar way as in the button example. I have uploaded the working sample code here for your perusal.

Please help!
Thanks in advance!

Regards,

Samar
AnswerRe: Adding custom routed event of user control to xaml of a window in wpf Pin
dashingsidds1-Sep-10 22:35
dashingsidds1-Sep-10 22:35 
Questionchanging skins Pin
V.1-Sep-10 4:23
professionalV.1-Sep-10 4:23 
AnswerRe: changing skins Pin
Ian Shlasko1-Sep-10 5:33
Ian Shlasko1-Sep-10 5:33 
GeneralRe: changing skins Pin
V.1-Sep-10 9:49
professionalV.1-Sep-10 9:49 
GeneralRe: changing skins Pin
Ian Shlasko1-Sep-10 10:16
Ian Shlasko1-Sep-10 10:16 
QuestionChange style of application Pin
tonydang1-Sep-10 0:38
tonydang1-Sep-10 0:38 
AnswerRe: Change style of application Pin
#realJSOP1-Sep-10 2:25
mve#realJSOP1-Sep-10 2:25 
QuestionHow to post my example Pin
tonydang31-Aug-10 23:24
tonydang31-Aug-10 23:24 
AnswerRe: How to post my example Pin
Pete O'Hanlon1-Sep-10 0:21
mvePete O'Hanlon1-Sep-10 0:21 
AnswerRe: How to post my example Pin
AspDotNetDev1-Sep-10 9:31
protectorAspDotNetDev1-Sep-10 9:31 
QuestionDate Problem in SL Pin
Jagz W31-Aug-10 21:05
professionalJagz W31-Aug-10 21:05 
AnswerRe: Date Problem in SL Pin
Pete O'Hanlon31-Aug-10 21:36
mvePete O'Hanlon31-Aug-10 21:36 
GeneralRe: Date Problem in SL Pin
Jagz W1-Sep-10 3:16
professionalJagz W1-Sep-10 3:16 
GeneralRe: Date Problem in SL Pin
Pete O'Hanlon1-Sep-10 3:17
mvePete O'Hanlon1-Sep-10 3:17 
GeneralRe: Date Problem in SL Pin
V.1-Sep-10 9:52
professionalV.1-Sep-10 9:52 
GeneralRe: Date Problem in SL Pin
Pete O'Hanlon1-Sep-10 23:03
mvePete O'Hanlon1-Sep-10 23:03 
GeneralRe: Date Problem in SL Pin
V.1-Sep-10 23:37
professionalV.1-Sep-10 23:37 

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.