Archive for the 'Programming' Category
WPF: How to set the SelectedValue on Data Bound ComboBox
Most of the time when you have a form, you will have some combo boxes, and some list boxes. If you are editing an existing item, most likely you are going to want to have these items display the currently selected value. So we are going to populate a form with some contacts and provide a combo box of companies that they could work for. When we select an individual contact from our list, we would expect the combo box to change and show the company the contact currently is associated with.
WPF Binding from the CornerRadius of a Border
Ok, after posing this question over at .NET Blog it took me all of about 30 seconds to realize what I needed to do.
Is it possible to do Binding on separate corners of the CornerRadius. I would like to have a slider that the top corners on the Border increase/decrease radius as the slider is moved. But I don’t want the bottom to corners to be affected.
I had used the tutorial over at Martin Grayson: Adventures of a ‘Designer’ to create a glass button for a project I am working on. This was a great starting point for my buttons, but there were a few things I needed to modify. I am only going to show you how I was able to bind to a slider to change the radius of the button.
The first thing I did was create the control template, notice though that where the corner radius is, I have binded it to a slider that I have added. But on the one corner, the corners originally were set to 4,4,0,0, which will mean that if we use the value from the slider, it will end up looking looking distorted like Figure 1.
WPF IDataErrorInfo and DataBinding
This is by far the best example of IDataErrorInfo and DataBinding that any beginner can easily grasp.
Employee Contacts (Part 4) - Building the Business Object Layer with PHP
Part 1 of this series covered building the MySQL database. In Part2, we built the data abstraction layer. With Part 3, we built our data access layer. At the data access layer, we made generated the queries to execute through the data abstraction layer. Part 4 of our series will cover the business object layer.
With the business layer, often times it will seem like we are simply making calls to the data access layer. And yes, that is true but remember that we are planning for future growth. A little extra time now can save you hours later down the road, and lead to far less headaches. As you will see when we build our presentation level, we should never make a direct call to the data access layer, those calls should be handled through our business layer.
C# StringBuilder Class
Have you ever had an extremely long string you needed to use in an ASP.NET web page? Or after it is displayed, have you ever wanted to view the source of the page to see what the string is outputting? Well, if you want to do this with a standard string, then you either get one long line string or you have to add line breaks where you want them. Personally, I don’t like adding the line breaks, as it is one more place I can have something break. Thankfully Microsoft has addressed this with the StringBuilder class, which I graciously use every time I have long strings to deal with. Read more »
Comments(1)
Comments(0)
Comments(0)