CRVS2010- crdb_adoplus.dll not found


I am using VS2010 and .NET 4.0 with WPF.
After installation SAP Crystal Report successfully,i integrated Report viewer in my WPF application.I am using a list to set Datasource for showing report.Everything works fine but when i run my solution then every time an error has occurred like this.
“System.IO.FileNotFoundException was unhandled Message=Could not load file or assembly ‘file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll’ or one of its dependencies. The system cannot find the file specified.”
This problem wasted my half day developing.After completion all google search and SAP forum at last get a solution.
To solve this add this code in your app.config file.
Here is the code

<startup useLegacyV2RuntimeActivationPolicy="true">
	<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

If you have any query about this topic please leave a comment.

WPF Listview Alternate Row Color


For setting the background color of Listview rows in an alternate fashion (odd rows and even rows) at first create a style element :

 <Style x:Key="alternatingStyle" TargetType="{x:Type ListViewItem}">
        <Style.Triggers>
            <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                <Setter Property="Background" Value="LightSkyBlue"></Setter>
            </Trigger>
            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                <Setter Property="Background" Value="LightGray"></Setter>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="Orange"/>                
            </Trigger>
        </Style.Triggers>
    </Style>

Now write this XAML code for ListView

<ListView BorderBrush="#FFA8CC7B" Height="133" HorizontalAlignment="Left" Margin="88,382,0,0" Name="lvInvDetails" VerticalAlignment="Top" Width="596"
                  ItemContainerStyle="{StaticResource alternatingStyle}" AlternationCount="2">
    <ListView.View>
        <GridView>
        <GridViewColumn DisplayMemberBinding="{Binding Path=InvoiceDetailsItemId}" Header="Item Id" Width="90" />
        <GridViewColumn DisplayMemberBinding="{Binding Path=InvoiceDetailsItemName}" Header="Item Name" Width="120" />                    
        </GridView>
    </ListView.View>
</ListView>

Now You can see alternation color of listview.
If you have any query about this topic please leave a comment.