I'm using MSVS2012 and I develop in C++ .NET. When debugging, I watch variables that are property 's of certain classes. When the property change I have to update the watches manually (because it implies calling get() to object instances) using the small "2-arrow icon" at the left of the watch boxes.
My question is: is it possible to set the debugger to enable it to automatically call the get() methods in order to refresh the displayed values? In other words, is it possible to see the property values as if they were simple variables?
Note: Maybe this applies to MSVS2010 too?
Thanks!
Well, you can't automatically refresh the properties, and there is a reason for that....
http://msdn.microsoft.com/en-us/library/z4ecfxd9.aspx
Calling for propertie
Related
In Xamarin Forms what is the difference between the EventHandlerBehavior and EventToCommandBehavior? I have been using the former successfully, but the latter was suggested to me to use instead. EventToCommandBehavior is less verbose which is a good thing.
About difference between EventHandlerBehavior and EventToCommandBehavior, I have some point, you can take a look:
For EventHandlerBehavior, you need to install Behaviors.Forms in your project firstly, behaviors let you add functionality to controls without having to subclass them. Instead, the functionality is implemented in a behavior class and attached to the control as if it was part of the control itself. Behaviors enable you to implement code that you would normally have to write as code-behind, because it directly interacts with the API of the control in such a way that it can be concisely attached to the control and packaged for reuse across more than one app.
For EventToCommandBehavior,the EventToCommandBehavior is a custom class, there are need you create EventToCommandBehavior class derives from the BehaviorBase class firstly, then implementing Bindable Properties, for detailed info, you can take a look:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/behaviors/reusable/event-to-command-behavior
So I suggest you can use EventHandlerBehavior, because you don't need to create many code behind.
2021 Edit
EventHandlerBehavior from community-toolkit is now equivalent to EventHandlerBehavior.
Documentation:
https://learn.microsoft.com/en-us/xamarin/community-toolkit/behaviors/eventtocommandbehavior
In Xamarin Forms what is the difference between the EventHandlerBehavior and EventToCommandBehavior?
Eventhandler like:
OnTextChanged, OnSelectedIndexChanged etc are defined behind the C# code file of XAML. These methods are completely tied to your controls you define behind your pages/controls.
However the Behaviors in Xamarin allows us to ATTACH them to any View. Your behavior will know which controls it is being attached to. Hence, for those Events like OnTextChanged/OnSelectedIndexChanged can be controlled from the Behaviors.
EventToCommandBehaivor: As we already know that Behavior get attached to any view; you have to define the behavior as such that It will expose the BINDABLE property for Commands. EventToCommandBehavior is just a normal behavior control which supports binding the Command and the Eventname. Which in runtime, whenever the Event for the control get fired, your behavior will execute the Command attached making it more ViewModel friendly.
Remember if you use Events; you are writing them behind the code base than ViewModel your logics are in two separate places. If you want to properly separate the logics from View and Model then then you have to use EventToCommandBehavior.
Let me know if you need more info.
I'm creating a ActiveX control. I've created a bunch of properties in a User Control and now I want to access those properties in the other modules, classes, forms, etc in the same project but I can't seem to find the correct syntax to do so?
Syntaxt I've tried:
connectString = user_control_name.DBConnectionString
connectString = Property("DBConnectionString")
connectString = Property(DBConnectionString)
connectString = Property Get ("DBConnectionString")
If you want to access a property on an instance of a UserControl on a specific form, you can do:
my_form_reference.my_usercontrol_name.my_property = <whatever>
If you want to access the instance of a UserControl that is in a UserControl, you will have to pass the reference to the UserControl via a property on the containing UserControl.
I generally recommend you don't pass UserControl references around. It is generally better to wrap up these controls, and not break abstraction.
If you want to access a property on an instance of a UserControl from inside the ActiveX Control project, I would recommend against it. The only way you can do this is by using module-level variables in a BAS module. This variable would potentially be accessible from every module in the project. You would have to set the variable in the UserControl_Initialize event of the control. However, I would strongly recommend you not doing this, because this creates an extra reference to your UserControl, which should really only have a reference from the containing Form or UserControl. This extra reference would mean that if the containing Form or UserControl was unloaded, the control would stick around in memory for the lifetime of your application, causing a memory leak. There are ways around this issue by using "weak references". But this is not supported in VB6, requires API hacks, and is prone to causing crashes.
I seriously would suggest you find some other way to do what you want. Perhaps you could explain exactly why you have this requirement.
Often, when I'm looking for information of how to set certain properties of controls (I'm using Visual Studio primarily, but this question does apply to any IDE), the examples I find normally involve programatically setting said properties.
Here's an example, using the DataGridView.DefaultCellStyle property on MSDN:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultcellstyle(v=vs.110).aspx
So my question is: is it better for a programmer to modify these properties by code, or is it better to use the IDE itself to change them via the properties pane? I realize that doing it the latter way will result in auto-generated code anyway, but it will be "somewhere else" in relation to the main bulk of user-generated code.
It depends on your requirements. If the app you are developing is planned to be dynamic, then it is a good idea to do it the way it is described in the reference you provided. For example, you may create a class containing the method which will set the basic settings of the gridview, so on every page you may just call this method and pass to it the gridview as a parameter instead of repeating setting the grid properties on every page.
I have been looking through the code and the pdf documentation and I can't find anything that indicates how the StockTrader sample application decides which view (PositionSummary or WatchList) should be displayed by default.
Can anyone explain how this is determined?
If I remember correctly, the stock trader RI uses its own custom behavior named AutoPopulateExportedViewsBehavior. This behavior is different from the one used by Prism as out of the box and is designed to work specifically with MEF. Along with the ViewExportAttribute it register the view in the container while also adding in to the corresponding region at start-up. You can find both of them in the StockTraderRI.Infrastructure project inside the Behaviors folder.
Edit:
Maybe I misread the question. If you are asking how it's determined which view between the PositionSummary and WatchList views is shown first, there is no specific configuration for this. The order is related to what module is initialized first. If you were to move the PositionModule after the WatchModule in the bootstrapper, the WatchList would be the one being shown by default.
I'm currently extending a custom "Platform" for VC-2010 (it is extremely similar to the standard pipeline and mostly just swaps 'cl' for 'gcc') and have run into a problem with the property pages.
I can't seem to figure out how to force a property page to always be visible. This page is for a tool that will pretty much always be run on a special control file that has many different tools run over it (hence why I don't want to directly link it to the file type via the 'FileExtension' in my 'ProjectSchemaDefinitions' file). So far I've only been able to get property pages to display when I've added a file with the correct 'ItemType' as an 'Item' in the vcproj file.
How can I make it so that my custom property page is always displayed, regardless of whether there is a property group for it in the vcproj file?
Thanks
A fresh look at the code this morning revealed the 'ProjectTools' MSBuild item which seems to do exactly what I want.