Infragistics ASP.NET controls

Xamarin releases cross platform starter kit. Example includes MVVM, SQLite, and more!

  Xamarin has released a cross platform starter kit for iOS, Android, and WinRT.  The application is a field service application that utilizes MVVM, the Xamarin.Mobile library for cross platform access to the camera, SQLite for storage, and much more! You can find the complete source code and other details here at the Xamarin official blog. Buddy James


XAML Basics: Styles

          Styles in XAML If you are a Microsoft Windows developer, chances are you are using XAML with one of the prominent development technologies (WPF, Windows Phone, SilverLight, WinRT).  XAML is a wonderful markup language that provides a whole new look at developing applications for the Microsoft Windows operating system.  In this series, I plan to cover the basics of XAML as they apply to these technologies.  Microsoft has put a lot behind XAML and I think we know that it has a bright future when it comes to Windows development. What are XAML styles? You can think of a style in XAML much as you would CSS styles in HTML.  Styles provide a way for you to change the visual properties of a given control or set of controls.  Never before has the developer had this much freedom when it comes to changing the appearance of the standard Windows controls.  Using Styles you can declare the font size and family of all buttons in an application.  You can create style resource files that serve as style libraries that can be shared by applications. This article will use WPF as the technology when explaining XAML styles, however, most if not all of the principles can be used with the other XAML based technologies. Defining styles in your application The way that you define styles is very much the same in WPF, SilverLight, and WinRT applications with subtle differences.  You can define styles at the Window, Page, UserControl, Application, and Resource Dictionary levels. We will start with an example of a WPF window called MainWindow.xaml. MainWindow.xaml <Window x:Class="WPF_styles_article_example.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <StackPanel Orientation="Vertical" > <Button Margin="20" Name="btnOne" Content="Button One" Width="260" Height="40"> </Button> <Button Margin="20" Name="btnTwo" Content="Button two" Width="260" Height="40"> </Button> </StackPanel> </Grid> </Window>   Here's the output As you can see, we have two buttons contained inside of a StackPanel.  They both share the same height and width. You typically want a consistent look for all elements of your application.  If you were to follow the method used in this example, you would need to find each button in the entire application to make any changes to the properties of your buttons.  The more properties that are set on the button, the more potential properties that you would need to change. The XAML style object Styles are defined in a Style object.  A xaml Style contains a collection of Setter objects.  These Setter objects allow you to specify the control type in which the style should be applied, the property of the control to change, and the property value that you wish to set for the specified control type.  Styles are defined in Resource Dictionaries.  Once you've created your Style and populated the setters to define the properties and property values to be applied, you can then reference this resource in the Style property of the control that you wish style.   Here is an example of changing the style of a control by binding a style resource to the control's Style property. <Window x:Class="WPF_styles_article_example.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <!-- Here we define our Style object and populate it's setter collection with property names and values. Notice that we specify the TargetType as the type of control that can use the style. --> <Style x:Key="CustomButtonStyle" TargetType="Button"> <Setter Property="FontFamily" Value="Verdana" /> <Setter Property="FontSize" Value="30" /> <Setter Property="Width" Value="260" /> <Setter Property="Height" Value="40" /> </Style> </Window.Resources> <Grid> <StackPanel Orientation="Vertical" > <!-- Notice that we have moved all visual property settings into the style resource. --> <Button Margin="20" x:Name="btnOne" Content="Button One" Style="{StaticResource CustomButtonStyle}" /> <Button Margin="20" Name="btnTwo" Content="Button two" Width="260" Height="40" /> <!-- Notice that setting the properties on the Button will override the properties specified in the style. --> <Button Margin="20" Name="btnThree" Content="Button three" Style="{StaticResource CustomButtonStyle}" FontSize="15" FontFamily="Wide Latin" /> </StackPanel> </Grid> </Window> Here's the output As you can see, we've taken the visual properties of btnOne and moved them into a Style resource.  We specify the x:Key property so that the style resource can be referenced by other controls.  We specify the type of control that can use the style by setting the TargetType property and populate the Style's Setter collection with Setter objects that define property names and values of the style. You'll also notice that we added a third button and set it's Style property just as we did with btnOne, however, btnThree overrides the properties that we defined in the Style resource.  Properties set at the control level take precedence over the properties defined in the Style resource. Creating a default style for a specified control type. In the previous example, we defined a Style resource and referenced the resource key in two of the three control's Style properties.  Since we didn't specify the Style property of btnTwo, it was not effected by the Style's defined Setter property values. What happens if we wanted to define a default Style for all of the button's for the current Window?  As it turns out, this process is fairly simple.  All we have to do is remove the Style's x:Key property.  This will cause all of the control's of the specified TargetType to apply the specified style.  Here is an example. <Window x:Class="WPF_styles_article_example.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <!-- I've removed the x:Key attribute to apply the style to all Buttons in the window. --> <Style TargetType="Button"> <Setter Property="FontFamily" Value="Verdana" /> <Setter Property="FontSize" Value="30" /> <Setter Property="Width" Value="260" /> <Setter Property="Height" Value="40" /> </Style> </Window.Resources> <Grid> <StackPanel Orientation="Vertical" > <!-- No styles set --> <Button Margin="20" x:Name="btnOne" Content="Button One" /> <Button Margin="20" Name="btnTwo" Content="Button two" /> <Button Margin="20" Name="btnThree" Content="Button three" /> </StackPanel> </Grid> </Window> Here's the output Applying styles across an entire application The previous examples demonstrate defining the Style resources at the Window level.  The same approach applies to Pages and UserControls. If you want to make styles available to the entire application, simply create an Application level resource.   Here is an example. <Application x:Class="WPF_styles_article_example.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <Style TargetType="Button"> <Setter Property="FontFamily" Value="Verdana" /> <Setter Property="FontSize" Value="30" /> <Setter Property="Width" Value="260" /> <Setter Property="Height" Value="40" /> </Style> </Application.Resources> </Application> Here's the output Conclusion This concludes the first article in the XAML basics series.  The next article in the series will build on the concept of XAML styles by introducing Control Templates. Stay tuned! kick it on DotNetKicks.com   


Syncfusion Essential Studio for WinRT Beta and Metro Studio product reviews

Syncfusion Essential Studio for WinRT Beta Syncfusion has been a major player in the 3rd party development component market for a while now.  Their products include .NET development UI controls for ASP.NET, ASP.NET MVC, ASP.NET Mobile, WinForms, WPF, Silverlight, and more.  The newest tool release is a suite of controls that are made for Windows 8 WinRT development.  The product is called Essential Studio for WinRT and it's made up of a plethora of highly attractive, cutting edge controls that are specifically designed for WinRT and touch interfaces.   20 Highly optimized controls Syncfusion Essential Studio for WinRT comes with 20 control that are designed with touch control and performance in mind.  The controls are vast and provide everything that you need to developing cutting edge user interfaces for your Windows 8 applications such as dashboards, maps, charts, and more. Microsoft Office document creation from within your WinRT applications The Studio suite comes with controls that allow your application to create Microsoft documents like Word, Excel as well as Adobe PDF documents on the fly.  The controls are completely independent and do not require Microsoft Office or Adobe Acrobat to be installed on the machine.  This is an incredible value which will allow applications to create receipts, invoices, work orders, or any other sort of document that you'd find in a standard line of business application. Samples included As with their other products, Syncfusion has bundled many sample applications (with source code) to help you to get up and running with the tools in no time.  The samples are written in C#/VB.NET and XAML.  Creating Windows 8 Graphics with Metro Studio Syncfusion has also offered a free product called Syncfusion Metro Studio.  Metro Studio is an extremely useful application that provides a huge selection of "Metro" style art snippets that you can edit.  This is a tremendous solution that helps you to add graphics to you Windows 8 applications.  The best part is it's FREE! The artwork is divided into logical groups for you to choose the art that best suites your needs.   When you select a graphic, you are presented with the option to edit the image.  Here you can change the size and color.  You can also preform transformations like rotate.  Syncfusion Metro Studio allows you to output the edited image as standard image files as well as XAML.   As you can see, Syncfusion have provided two extremely useful tools for Windows 8 developers and not only are they first class tools, they are also free! Check them out today! Syncfusion Essential Studio for WinRT Beta  Syncfusion Metro Studio


Windows 8: Things that every IT professional should know about Microsoft's new OS

Windows 8 features that you should know about I've recently purchased a Windows 8 tablet and upgraded my development machine to Windows 8.  I'm absolutely thrilled with this operating system.  I'm still getting used to the tablet paradigm which is to be expected.  The tablet goes from power button to "start screen" in 14 seconds!  I primarily use the desktop mode on my development machine and the speed of the operating system is incredible.  I upgraded from Windows 7 to Windows 8 and the difference in speed is as if I'm using a different machine!   It's well known by now that the new OS starts in "Tile Mode" and that there is now a Windows App store.  in this post, I'd like to cover some of the lesser known aspects of the new operating system that I believe will be useful to IT professionals. Advancements in security UEFI (Unified Extensible Firmware Interface)                                                                                                                                                   The UEFI technology allows the implementation of security policies in your system's firmware.  Windows 8 utilizes UEFI by way of the secure boot protocol to verify the authenticity of your low level system components at boot time pre-OS.  Malware like Rootkits will attack the boot loading process and infect critical operating system files which can then bring havock to your system and can be very difficult to identify and remove.  If enabled, Secure boot will facilitate the validation of digital signatures of the OS components responsible for booting the system.  If a digital signature or key is incorrect, this indicates that it has been tampered with at which time the "Recovery Environment" will load and attempt to resolve the discovered issues.  Secure boot is a protocol of UEFI.  The UEFI technology is staged to replace the BIOS found in PC's today.  This will allow firmware developers more flexibility in designing hardware.  One of the key changes will be the replacement of the IRQ based CPU interrupt mechanism found in today's BIOS for an event driven architecture for modern firmware. For more information regarding UEFI, Secure boo, and the Windows 8 secured boot architecture, visit the following msdn blog article by Steven Sinofsky here . SmartScreen filter The SmartScreen technology utilizes a reputation based system for website URLs as well as file downloads.  When you visit a webpage in IE, the URL will be checked against the SmartScreen database.  If the URL has been marked as malicious then the browser will display a warning to the user.   The download manager will warn you of any file downloads that have been marked as unsafe by previous user's.  The SmartScreen filter is a very efficient method of protecting against phishing attacks and malware.  The feature can be enabled or disabled.  User's can contribute to the accuracy of the SmartScreen database by providing feedback on URL's and file downloads.  You can read about the SmartScreen feature at the following Microsoft website. System exploit mitigation improvements                                                                                                                                             Windows 8 has many improvements in the area of exploit mitigation.  Windows Vista introduced Address Space Layout Randomization (ASLR) which is a technique that randomly moves the location of executing code and data in memory.  This was an attempt at mitigating the infamous buffer overrun exploit.  Malicious hackers have found ways to beat ASLR and Windows 8 has improved the process by speeding up the randomization mechanism.  There are other improvements such as changes to the Windows kernel and the memory heap which include integrity checks and approaches similar to ASLR.  Internet Explorer 10 has the Enhanced Protected Mode sandbox as well as ASLR support by way of a ForceASLR option that will randomize all loaded modules. Improved Task manager One of my favorite additions to Windows 8 is the new and improved Task Manager.  If you've used Sysinternals ProcessExplorer then the new interface may look familiar to you.  It provides very clear and concise displays for system resource consumption.  Here are a couple of screen shots.   I'd recommend Windows 8 to anyone.  And at $39 for an upgrade to Windows 8 Pro, how can you not want to upgrade? Buy the upgrade here  kick it on DotNetKicks.com    


About the author

My name is Buddy James.  I'm a Microsoft Certified Solutions Developer from the Nashville, TN area.  I'm a Software Engineer, an author, a blogger (http://www.refactorthis.net), a mentor, a thought leader, a technologist, a data scientist, and a husband.  I enjoy working with design patterns, data mining, c#, WPF, Silverlight, WinRT, XAML, ASP.NET, python, CouchDB, RavenDB, Hadoop, Android(MonoDroid), iOS (MonoTouch), and Machine Learning. I love technology and I love to develop software, collect data, analyze the data, and learn from the data.  When I'm not coding,  I'm determined to make a difference in the world by using data and machine learning techniques. (follow me at @budbjames).  

Related links

Month List