After a long time after my first microsoft certification,70-536,.NET Framework - Application Development Foundation today i have taken the certification for WPF, Microsoft .NET Framework 3.5, Windows Presentation Foundation Application Development,70-502.
This one is easy for anyone who has some hands on experience in WPF.One has to be familiar with the different panels and layout,Binding,Styles and Templates.Other than that some knowledge on click once deployment would also be of help.
The best way to prepare for this,would be to have a visual studio up and running and try out different things on WPF.
I would suggest the books Sams WPF Unleashed and Pro WPF to start with.Both are really helpful.Apart from that check out the various blogs and forums out there.Just google and you would find a hell lot of those,just like you found this one:)
Just gonna relax the day ahead after the hard earned certification :):)
Tuesday, August 25, 2009
Thursday, August 20, 2009
SolidColorBrush List from Brushes
Hi,
Everybody will be using Brushes,which implements a set of predefined SolidColrBrush objects,to choose various colors.
Sometimes you may want to get a list of all these brushes up in your application,so that the user can select the color of his/her choice.
To get the list of colors from Brushes you can use the following piece of code
Here dictBrushes will give what you want.
You can use this in your view,bind to a combobox if you want and show the possible selections of color
Hope it helps :)
Everybody will be using Brushes,which implements a set of predefined SolidColrBrush objects,to choose various colors.
Sometimes you may want to get a list of all these brushes up in your application,so that the user can select the color of his/her choice.
To get the list of colors from Brushes you can use the following piece of code
Dim dictBrushes As New Dictionary(Of String, SolidColorBrush)
For Each objPropertyInfo As PropertyInfo In GetType(Brushes).GetProperties
If (objPropertyInfo.PropertyType Is GetType(SolidColorBrush)) Then
dictBrushes.Add(objPropertyInfo.Name,objPropertyInfo.GetValue(Nothing, Nothing))
End If
Next
Here dictBrushes will give what you want.
You can use this in your view,bind to a combobox if you want and show the possible selections of color
Hope it helps :)
Labels:
WPF
Thursday, August 6, 2009
Scrolling a Disabled Listbox in WPF
Recently I had a requirement when developing an application,where i needed a listbox which was to be disabled but yet can be scrolled,so that all the contents in it was visible.Applying the property,IsEnabled=False makes the whole listbox disabled even disabling the scroll.
I just found out a way around this.I created a custom listbox(MyScrollableListbox) with a property IsItemsEnabled.Setting this property to true,gives the normal listbox behaviour.When set to false only the ItemsPresenter of the listbox is disabled,so that scrolling is possible
The Custom Listbox looks like this(just one property added for now)
In the xaml(or if you are going to make it a custom control then you can give it in your Generic.xaml)
Now if you set the property IsItemsEnabled to false the listbox will be disabled,but allowing you to scroll.
edit: Added in CodeProject
Hope it helps :)
I just found out a way around this.I created a custom listbox(MyScrollableListbox) with a property IsItemsEnabled.Setting this property to true,gives the normal listbox behaviour.When set to false only the ItemsPresenter of the listbox is disabled,so that scrolling is possible
The Custom Listbox looks like this(just one property added for now)
Public Class MyScrollableListbox
Inherits ListBox
Public Property IsItemsEnabled() As Boolean
Get
Return GetValue(IsItemsEnabledProperty)
End Get
Set(ByVal value As Boolean)
SetValue(IsItemsEnabledProperty, value)
End Set
End Property
Public Shared ReadOnly IsItemsEnabledProperty As DependencyProperty = _
DependencyProperty.Register("IsItemsEnabled", _
GetType(Boolean), GetType(MyScrollableListbox), _
New FrameworkPropertyMetadata(Nothing))
End Class
In the xaml(or if you are going to make it a custom control then you can give it in your Generic.xaml)
<Grid>
<local:MyScrollableListbox x:Name="ListBox1" Margin="41,35,0,0" Height="83" HorizontalAlignment="Left" VerticalAlignment="Top" Width="69">
<local:MyScrollableListbox.Style>
<Style TargetType="{x:Type local:MyScrollableListbox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border>
<ScrollViewer>
<ItemsPresenter IsEnabled="{Binding Path=IsItemsEnabled, RelativeSource={RelativeSource TemplatedParent}}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</local:MyScrollableListbox.Style>
</local:MyScrollableListbox>
</Grid>
Now if you set the property IsItemsEnabled to false the listbox will be disabled,but allowing you to scroll.
edit: Added in CodeProject
Hope it helps :)
Labels:
WPF
Subscribe to:
Posts (Atom)