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.



Silverlight The type or namespace name 'BitmapImage' could not be


While Using Silverlight if you are getting the following Error "The type or namespace name 'BitmapImage' could not be found (are you missing a using directive or an assembly

reference?)
" Just Include namespace System.Windows.Media.Imaging; in your application



Monday, December 7, 2009

How To Pass values from iframe to Controls In parent Document


if(parent.document.Yourformname.YOurfieldname != null){

    parent.document.Yourformname.YourfieldId.value = SetYourValue;
}

For Div Content

if(parent.document.all["DIVName"] != null){

    parent.document.all["YourDIVName"].innerHTML =  SetYourValue;
}



How to call the function with parameter in iframe


var objIFrame = document.frames["ifrmId"];
    if ((objIFrame ) && (objIFrame .fnNameInIframe)) {
        objIFrame .fnNameInIframe(Param1);
    }



Thursday, December 3, 2009

Whats The Difference Between Manifest and Metadata

Metadata describes contents in an assembly, classes, interfaces, enums, structs, etc.

Manifest describes an assembly itself, Assembly name version number, culture, strong name, etc.



Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.