Thursday, October 2, 2008

format date in xaml

xmlns:local="clr-namespace:.Utility">






//DateTime format Binding
namespace .Utility
{
///
/// Utility class to convert the date format
///

public class PositionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
//converts the format during Binding
return String.Format("{0:s}", value).Remove(10);
}
return "";
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{

throw new Exception("The method or operation is not implemented.");
}

}
}

date format tht will help you out,

DateTime dateTime = DateTime.Now;
C.WriteLine ("d = {0:d}", dateTime ); // mm/dd/yyyy
C.WriteLine ("D = {0:D}", dateTime ); // month dd, yyyy
C.WriteLine ("f = {0:f}", dateTime ); // day, month dd, yyyy hh:mm
C.WriteLine ("F = {0:F}", dateTime ); // day, month dd, yyyy HH:mm:ss AM/PM
C.WriteLine ("g = {0:g}", dateTime ); // mm/dd/yyyy HH:mm
C.WriteLine ("G = {0:G}", dateTime ); // mm/dd/yyyy hh:mm:ss
C.WriteLine ("M = {0:M}", dateTime ); // month dd
C.WriteLine ("R = {0:R}", dateTime ); // ddd Month yyyy hh:mm:ss GMT
C.WriteLine ("s = {0:s}", dateTime ); // yyyy-mm-dd hh:mm:ss (Sortable)
C.WriteLine ("t = {0:t}", dateTime ); // hh:mm AM/PM
C.WriteLine ("T = {0:T}", dateTime ); // hh:mm:ss AM/PM

Monday, September 15, 2008

XBAP IOException: Cannot locate resource file.xaml

Tuesday, September 2, 2008

Use OpenXML on an Xml document with a default namespace

this is an interesting stuff

BEGIN

SET NOCOUNT ON;
declare
@XmlAddHandle int,
@XmlDeleteHandle int,
@xmlString varchar(max)

set @xmlString = '


e27b4a1b-3f75-44b2-9538-4acc108505d2
nokia 6280
In Work
child scenario
2008-08-23T00:00:00+05:30
planner
17bb0215-1daa-4195-96e2-9feeefecac73


e27b4a1b-3f75-44b2-9538-4acc108505d2
ed5c9c5e-5b59-49af-add2-d16a08b686df
2008-09-01T14:59:10.953+05:30

'

EXEC sp_xml_preparedocument @XmlAddHandle output, @xmlString,''

SELECT * FROM OPENXML(@XmlAddHandle,'//a:Scenario',2) WITH ([a:Status] varchar(20))


EXEC sp_xml_removedocument @XmlAddHandle

END

Thursday, August 28, 2008

return xml from sql server

select * from table name FOR XML RAW, ELEMENTS XSINIL, BINARY BASE64

Wednesday, August 27, 2008

change column name of sql table

EXEC sp_rename
@objname = 'TableName.FieldName',
@newname = 'NewFieldName',
@objtype = 'COLUMN'

Wednesday, August 20, 2008

selecting a combobox value in WPF

now im in WPF browser application ,
everything seems to be complicated unless otherwise

System.Windows.Controls.ComboBoxItem Value = this.cmbStatus.SelectedValue as ComboBoxItem;

Value.Content.ToString();