Month: January 2013

Silverlight : Hooking up a Default Button Action

One of the typical things that you may want to accomplish on a particular UI implementation in Silverlight is to have a default button that is triggered through the use of the enter key. For this Silverlight provides support UI Automation through a set of peer classes that derive from AutomationPeer. Most controls contain an AutomationPeer object …in our example the Button control has a ButtonAutomationPeer class.   So in order to make this happen we are going to set up a behavior that we can simply attach to a control and configure to point to the button that we would like for the Enter key to trigger. So we simply start out with a simple behavior class public class DefaultButtonBehavior : TargetTriggerAction<ButtonBase> {   private AutomationPeer _automationPeer {get;set;}   private ButtonBase _targetButton {get;set;}   } Nothing fancy here. Wu use TargetTriggerAction to say that this is specifically targeting an object of type ButtonBase. This will enable use to target anything that also derives from ButtonBase. So in regards to controls like Telerik and their RadButton control, you would be able to use the same code to target their control. The AutomationPeer and ButtonBase objects are specifically there so that we can get hooks into the targeted button and more importantly it’s AutomationPeer object. Now we are ready to start implementing some basic code in order to override what...

Read More

BlogEngine.NET Settings Not Saving With Values Other Than Text

You may be using BlogEngine.NET 2.7 for your blogging solution like I am and have run into a rather sticky situation in which Settings values from non scalar entities are not saving the values of properties if they are anything other than text properties. This was a little frustrating to me since I have used BlogEngine.NET in the past but the framework and thus the code has grow what seems to be exceeding complex. So where do you look in order to correct this? Well, in the admin section of the source code there is a user control for Settings.ascx.If you look specifically at the code you will notice that the Textbox items are the only ones that check to see if the particular setting that you are updating is a scalar value or not. All of the other ones merely try to update the values. Not exactly what you want to happen. So if I want to say, have Checkboxes properly add their values then I have to update the code that starts around line 129 of the Settings.ascx.cs file like this.    1: foreach (Control ctl in this.phAddForm.Controls) 2: { 3: switch (ctl.GetType().Name) 4: { 5: case "TextBox": 6: { 7: var txt = (TextBox)ctl; 8:  9: if (this.Settings.IsScalar) 10: { 11: this.Settings.UpdateScalarValue(txt.ID, txt.Text); 12: } 13: else 14: { 15: this.Settings.AddValue(txt.ID, txt.Text); 16: } 17: }...

Read More

Review: Samsung 840 Series 250GB Sata III Solid State Drive

In order to be a little more productive at work, I decided that it was high time that I switched out my older 500GB mechanical hard drive with an SSD. My old setup was utilizing a Hitatchi 500GB internal hard drive. Nothing fancy but it had finally gotten to the point where to boot up the laptop it was taking 5 minutes to get to the login screen and then another 5 minutes to get logged in. Not exactly what you need when you already have one thousand fires burning that need put out. After doing a little research and shopping around I finally settled on the Samsung 840 Series. I have had pretty good luck in the past with Samsung products in the past and the reviews were all pretty good. I did have a concern about the SSD bricking on me since we have one person in our office that had to go through that experience. So after doing a little more research I settled on the option to do the following:   Clear off all of my documents etc. etc. off onto an external drive to bring the size of my files down. Clone the mechanical hard drive onto the SSD and place the SSD in the laptop drive bay. Wipe the mechanical hard drive and reformat. Purchase a drive caddy for the optical bay similar...

Read More