Show Image using byte array in WPF

Convert your image in to byte array
private byte[] GetImageAsByteArray(string imageName)
{
var streamResourceInfo =
Application.GetResourceStream(new Uri("YourProjectNameSpace;component/ImageFolderName/"+imageName)",
UriKind.Relative));
byte[] image = {};
if (streamResourceInfo != null)
{
var length = streamResourceInfo.Stream.Length;
image = new byte[length];
streamResourceInfo.Stream.Read(image, 0, (int)length);
}
return image;
}

Sample Usage
var yourViewModel = new ViewModel();
yourViewModel.Image=GetImageAsByteArray("jemi.jpg");

Bind the property to the image control

<Image Source=”{Binding Image}”></Image>

How Layout Process works in WPF?

Before you design the layout you need to understand what’s going behind the scenes when you create layouts in your applications. If you have knowledge about the layout process, you know what happens with your elements and you can build really great layouts.

The Layout process is two step process. It consists of the steps Measure andArrange . In the first step, the Measure step elements calculate their desired size.That means each element calculate their own size.To do this an element calls the Measure method in each direct child.After this , the DesiredSize property of the child is set. The parent element can access this DesiredSize and calculate it’s own desired size.The whole process walks down the element tree so it starts at the parent element,which calls measure on each direct child and each direct child again calls Measure on its direct children.
In the second step,the Arrange step,elements arrange their children. They do this by calling Arrange method on each direct child.The Arrange method takes a position and a final size.That means child knows the position for render and size as well.After the two process rendering occurs.

Change Telerik GridViewCellColor based on value

You can change Gridview cell color based on a value by using CellStyleSelector in GridViewDataColumn.
First you have to add a class by inheriting StyleSelector and override SelectStyle method
public class MyStyle:StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
if(item is Student)
{
var objEntity = item as Student;
if (objEntity.Mark > 60)
{
return Green;
}

}
return null;
}
public Style Green { get; set; }
}
Add a Grid Resource

<Grid>
<Grid.Resources>
<my:MyStyle x:Key="myStyle">
<my:MyStyle.Yellow>
<Style TargetType="telerik:GridViewCell">
<Setter Property="Background" Value="Green" />

</Style>
</my:MyStyle.Yellow>
</my:MyStyle>
</Grid.Resources>

</Grid>

Apply the style to GridViewDataColumn CellStyleSelector Attribute

<telerik:GridViewDataColumn DataMemberBinding="{Binding Mark}" CellStyleSelector="{StaticResource myStyle}">
</telerik:GridViewDataColumn>

Happy coding…

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms

1

 

I have seen this error two times before when i try to build WPF and WindowsPhone application .I had a hard time with this issue.

How to resolve this error?

Open the Run window and type regedit 

2

Click OK and then Navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa 

3

4

 

DELETE this registry entry by right clicking the FipsAlgorithmPolicy folder and restart the application.It will resolve the issue