tag:blogger.com,1999:blog-5295746446529817470.post3984278513163586817..comments2023-05-09T16:29:24.130+02:00Comments on Dotnet by Example: A WinRT behavior to mimic EventToCommandJoost van Schaikhttp://www.blogger.com/profile/02182444268071162776noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-5295746446529817470.post-42476972263331339432013-05-23T09:44:17.905+02:002013-05-23T09:44:17.905+02:00If anyone is interested how to remove the dependen...If anyone is interested how to remove the dependency on Reactive framework, here's the solution:<br />http://stackoverflow.com/questions/16647198/how-to-dynamically-bind-event-to-command-in-winrt-without-reactive-frameworkUnknownhttps://www.blogger.com/profile/15215234750683777914noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-1349510620635591442013-05-13T21:31:13.538+02:002013-05-13T21:31:13.538+02:00@Sebastian (and others) - if you get the error ‘&q...@Sebastian (and others) - if you get the error ‘"A value of type 'EventToBoundCommandBehavior' cannot be added to a collection or dictionary of type 'BehaviorCollection' you probably have messed up references. Please make a backup from your project, remove all nuget packages from it, clear the bin directory, and then add win8nl as nuget package again. That should solve it. There is a chance your app.xaml gets messed up - hence the backup of that.Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-57252566652526278312013-05-01T08:56:44.898+02:002013-05-01T08:56:44.898+02:00@Pallam, I don't think your comment quite got ...@Pallam, I don't think your comment quite got trough the way you intendendJoost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-628565560834681272013-04-27T14:11:08.279+02:002013-04-27T14:11:08.279+02:00Is any thing wrong with CommandParameter, I am usi...Is any thing wrong with CommandParameter, I am using like below:<br /><br /> <br /> <br /> <br /> <br /><br />Please tell me, i am always getting null, if i binded property from viewmodel its giving value but not with the listbox elementPallam Madhukarhttps://www.blogger.com/profile/05569815245335946887noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-27343588006489372412013-03-13T10:12:05.268+01:002013-03-13T10:12:05.268+01:00Rob, you might want to have a look at http://dotne...Rob, you might want to have a look at http://dotnetbyexample.blogspot.nl/2012/11/passing-eventargs-to-winrt.html. We have got you covered buddy! ;)Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-64741014869364841512013-03-12T21:19:51.425+01:002013-03-12T21:19:51.425+01:00Thank you for taking the time to produce and suppo...Thank you for taking the time to produce and support a very useful library. I want to get at an events argument in my view model (TextBox - KeyDown event, which key was pressed). Is it possible to bind the command parameter to the event arguments? Thanks in advance.Anonymoushttps://www.blogger.com/profile/09407520307889288504noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-18861396563552750142013-02-24T13:21:40.033+01:002013-02-24T13:21:40.033+01:00@Xander - what did you do exactly? You added win8n...@Xander - what did you do exactly? You added win8nl or winrtbehaviors? You will need win8nl. Did you add the namespace at the top of your XAML file? If you did all this, can you send me a small repro showing your problem?Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-25053134676695470652013-02-18T23:49:57.719+01:002013-02-18T23:49:57.719+01:00I added the project via nuget, but when I add the ...I added the project via nuget, but when I add the xaml, I get the error "Interaction does not exist in the namespace WinRtBehaviors" and "EventToCommandBehavior does not exist in the namespace Win8nl_Behavior" and ideas?Xander Dumainehttps://www.blogger.com/profile/05176697634579495689noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-21536158192656182122013-01-25T09:42:35.292+01:002013-01-25T09:42:35.292+01:00@Sébastien could you please send me a repro? I get...@Sébastien could you please send me a repro? I get a lot of questions and guessing what your code looks like before even trying to debug it is not very productive ;-)<br />And please refrain from entering a lot of empty lines in your comment :)Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-31895411637500735892013-01-25T07:52:19.375+01:002013-01-25T07:52:19.375+01:00Hello,
I used your excellent EventToBoundCommandB...Hello,<br /><br />I used your excellent EventToBoundCommandBehavior in 3 GridView in my Win8 app.<br /><br />In one of them, I'm getting this error: <br /><br />"A value of type 'EventToBoundCommandBehavior' cannot be added to a collection or dictionary of type 'BehaviorCollection'. <br /><br /><br /> <br /> <br /> <br /><br /> <br /><br /> <br /> <br /><br /> <br /><br /> <br /><br /><br />Please note that in my 2 other GridView, the winRtBehaviors:Interaction.Behaviors is in the same PostPreviewControl.<br /><br />Thanks!<br />ArchieCoderAnonymoushttps://www.blogger.com/profile/06402929906159470045noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-4050176145213943052013-01-19T13:02:10.029+01:002013-01-19T13:02:10.029+01:00@MK07 Sorry for the late response, have been quite...@MK07 Sorry for the late response, have been quite busy for some time. I've added a sample project to http://dotnetbyexample.blogspot.nl/2012/11/a-winrt-behavior-to-mimic.html that I hope will show you how to do it. Scroll down to see sample code and a complete download linkJoost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-62179874729937506252013-01-10T05:57:47.361+01:002013-01-10T05:57:47.361+01:00Hi Joost,
Thanks for the awesome library.
I have ...Hi Joost,<br /><br />Thanks for the awesome library.<br />I have a Gridview and I want to get the ItemClicked as I want to tap the ItemClicked event and not the selection changed.<br /><br />What is the possible solution for the same.Manvikhttps://www.blogger.com/profile/05226242576116892349noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-47856083845260965522012-11-05T13:53:35.361+01:002012-11-05T13:53:35.361+01:00@Amit you probably try to attach to an event that&...@Amit you probably try to attach to an event that's not a RoutedEvent. That's the limitation of this approach.Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-85494478785467493652012-11-05T10:18:41.219+01:002012-11-05T10:18:41.219+01:00This does not work for me.
I keep getting null on...This does not work for me.<br /><br />I keep getting null once on the following line:<br />var commandGetter = dcType.GetRuntimeMethod("get_" + Command, new Type[0]);<br /><br />when I check by using GetRuntimeMethods I see that indeed there is no matching name...<br /> Any advice?<br /><br />Thanks<br /><br />AmitAmit Razhttps://www.blogger.com/profile/17290643042552910621noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-72717182638527982542012-10-04T21:21:46.851+02:002012-10-04T21:21:46.851+02:00@Renato, thanks for your compliments. Unfortunatel...@Renato, thanks for your compliments. Unfortunately the behavior does not support command binding right now. I think the behavior could be fairly easy adapted to do that, by changing Command to type ICommand, binding to that and that directly invoke the command in stead of doing the Reflection dance as I do nowJoost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-81212766880416651582012-10-04T18:17:56.636+02:002012-10-04T18:17:56.636+02:00Hi Joost,
first thank you on this great library. ...Hi Joost,<br /><br />first thank you on this great library. It's a real saver :)<br /><br />One quick question.<br /><br />Is it possible with your lib to bind command in eventtocommand like<br /><br />... Command={Binding SomeCommandToBindFromParent} ... <br /><br />or we only can pass regular string to Command like<br /><br />... Command="SomeCommand"...<br /><br />I'm asking this because I have case when I need to bind command from parent datacontext and if we only can invoke commands without binding I'm afraid that I cannot do that. Or I'm not seeing something :)<br /><br />Thank you in advance!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-49240013262108669142012-09-16T18:22:19.959+02:002012-09-16T18:22:19.959+02:00I checked em out. I came to the conclusion that it...I checked em out. I came to the conclusion that its the commandparameter i havent bound correct.<br /><br /><br /><br />I need to bind it to the selected item.<br /><br />Then I also found out that there might be a few issues later also, as the frame.navigate is not accessible from the viewmodel.<br /><br />So right now i just added an eventhandler in code behind.<br />ItemClick="WelcomeTileClickedHandler"Anonymoushttps://www.blogger.com/profile/06184768896142660726noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-78951689345352513382012-09-16T18:01:54.906+02:002012-09-16T18:01:54.906+02:00@poul, there are some sample solution associated w...@poul, there are some sample solution associated with this article. Did you check them out? If you did and that did not help, can you send me a mini-solution to repro demonstrate your problem (putting questions marks on what you exactly don't understand) and then I will have a look at it.Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-69516816075924503532012-09-15T19:59:06.331+02:002012-09-15T19:59:06.331+02:00Hello
I am trying to use a Gridview as a menu to ...Hello<br /><br />I am trying to use a Gridview as a menu to navigate to other pages.<br /><br />I have added following to the gridview:<br /><br /><br /><br /><br /><br /><br />The event is fired but i dont know how to bind it properly.<br /><br /> public ICommand WelcomeTileClick<br /> {<br /> get<br /> {<br /> return new RelayCommand(async (p) =><br /> {<br /> if (p != null)<br /> {<br /> var msg = new MessageDialog(string.Format("Hi there {0}", p.Title));<br /> await msg.ShowAsync();<br /> }<br /> });<br /> }<br /> }<br /><br />p is always null.<br /><br />Any idea how i should do it?Anonymoushttps://www.blogger.com/profile/06184768896142660726noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-1845568684488579692012-09-14T17:24:58.832+02:002012-09-14T17:24:58.832+02:00@OzFab I am afraid you don't. For the command ...@OzFab I am afraid you don't. For the command parameter you need something to bind to. But it would be fairly easy to write a behavior that does what you want based upon the code I wroteJoost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-17642832133436473032012-09-13T11:53:42.014+02:002012-09-13T11:53:42.014+02:00@sean any change of you sending me an as small as ...@sean any change of you sending me an as small as possible solution demonstrating the problem?Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-19584652789935958202012-09-11T21:56:03.886+02:002012-09-11T21:56:03.886+02:00Hi Joost, thank you for your work in this area. I ...Hi Joost, thank you for your work in this area. I am having an issue with the use of EventToCommandBehaviour.<br /><br />I have textblocks contained in a gridView, and the TextBlock definition within the DataTemplate for the gridView defines a EventToCommandBehaviour is defined and bound to a command in viewModel.<br /><br />The command does not get executed when the textblock is clicked. I can use the same textBlock definition outside of a gridview and it works. <br /><br />Any idea what I am doing wrong. All help is greatly appreciated.<br /><br />Thanks.Sean OChttps://www.blogger.com/profile/03180376815647854833noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-18159662646508889042012-09-05T15:17:35.326+02:002012-09-05T15:17:35.326+02:00Hi Joost,
Thanks a lot for this, this is great.
I...Hi Joost,<br /><br />Thanks a lot for this, this is great.<br />I just have a question though, I would you bind a command to the ItemClick event of a Gridview? I managed to bind the command, but not the clicked item as a parameter.<br /><br />Thanks!Fabien Ruffinhttps://www.blogger.com/profile/14231487726567879751noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-36675759384345857602012-09-02T21:19:24.985+02:002012-09-02T21:19:24.985+02:00Thanks, that cleared up the issue for me!Thanks, that cleared up the issue for me!radiumhttps://www.blogger.com/profile/14557051114574530215noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-64451517928527207602012-09-02T11:21:04.132+02:002012-09-02T11:21:04.132+02:00@Sean, @radium: I've updated the article with ...@Sean, @radium: I've updated the article with two sample solution links. I hope they will show you more clearly how things work and how the should and can be used.Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.com