Friday, January 1, 2010

Wishing you all a very joyful, peaceful and happy New Year.

Wishing you all a very joyful, peaceful and happy New Year.



Thursday, December 31, 2009

How To Add Border To Image Within DataGrid Column in Silverlight


<data:DataGridTemplateColumn Header="Image">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Border BorderBrush="Black" Width="101"  BorderThickness="1,1,1,1" Height="13" >
                                    <Image Width="25" Height="11" Source="http://localhost/SLR/images/pers_org.png" Stretch="UniformToFill" HorizontalAlignment="Left"  Canvas.Top="0" Canvas.Left="0" >
                                    </Image>
                                </Border>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                    </data:DataGridTemplateColumn>

//Bind the Following code within datagrid LoadingRow Event

Border border = (Border)dgName.Columns[4].GetCellContent(e.Row);// value 4 is the Possible of the Cell in the datagrid
Image image = (Image)border.Child;
//RelMang tmpRm = (RelMang)e.Row.DataContext;
//image.Width = Convert.ToDouble(tmpRm.mx_Rel_Prcntg.ToString());
image.Width = Convert.ToDouble(20); // Dynamically Setting Width of the Image Which in Datagrid Cell

Thursday, December 24, 2009

Silverlight How To Pass Values Between Pages or Forms

In App.xaml.cs have declared some application level variables as follows,

private string valueToPass

public string valTo
{
    get
    {
        return valueToPass;
    }
    
    set
    {
        valueToPass = value;
    }
}

page1.xaml.cs

App ap = (App)Application.Current;
ap.valueToPass = "YourValue";


page2.xaml.cs

App ap = (App)Application.Current;
messageBox.show(ap.valueToPass);

How To wrap Text In silverlight DataGrid Column

Make your datagrid AutoGenerateColumns="False" , then do the following changes to wrap text in the datagrid coloumn

<data:DataGridTemplateColumn Header="Your Header" Width="150">
         <data:DataGridTemplateColumn.CellTemplate>
                 <DataTemplate>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Your_Data_Display}" />
                 </DataTemplate>
        </data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>

Wednesday, December 23, 2009

Silverlight The type or namespace name 'IValueConverter' could no


While Using Silverlight if you are getting the following Error "The type or namespace name 'IValueConverter' could not be found (are you missing a using directive or an assembly reference?)" Just Include namespace System.Windows.Data; in your code behind.