0% found this document useful (0 votes)
236 views

CS411 PPT

The document contains code examples demonstrating the use of C# and XAML for GUI development. It includes examples of controls, layouts, data binding and event handling.

Uploaded by

Muqadas Zahra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views

CS411 PPT

The document contains code examples demonstrating the use of C# and XAML for GUI development. It includes examples of controls, layouts, data binding and event handling.

Uploaded by

Muqadas Zahra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 257

Console.WriteLine("It is {0} that C\# Station provides C\# programming language content.

", content);
Console.WriteLine("myInts[0]: {0}, myInts[1]: {1}, myInts[2]: {2}", myInts[0], myInts[1], myInts[2]);
Console.WriteLine("myDoubles[0, 0]: {0}, myDoubles[1, 0]: {1}", myDoubles[0, 0], myDoubles[1, 0]);

Console.WriteLine("myStrings[0]: {0}, myStrings[1]: {1}, myStrings[2]: {2}", myStrings[0], myStrings[1], myStrings[2]);


dObj[3] = new DrawingObject();
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
XmlReader xmlReader = XmlReader.Create("http://www.ecb.int/stats/eurofxref/eurofxref -daily.xml");
foreach (XmlNode xmlNode in xmlDoc.DocumentElement.ChildNodes[2].ChildNodes[0].ChildNodes)
Console.WriteLine("Please enter new content for the file - type exit and press enter to finish editing:");

Console.WriteLine("Please enter new content for the file - type exit and press enter to finish editing:");
Console.WriteLine("Please enter new content for the file - type exit and press enter to finish editing:");
DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
FieldInfo fieldInfo = t.GetField(varName , BindingFlags.NonPublic | BindingFlags.Static);
Console.WriteLine("I don’t seem to know much about you. Please enter the following information:");
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="OK" Click="button_Click"/>
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="OK" Background="White"/>
b.Background = (Brush)System.ComponentModel.TypeDescriptor.GetConverter(typeof(Brush)).ConvertFromInvariantString("White");

<Button xmlns=’’http://schemas.microsoft.com/winfx/2006/xaml/presentation ’’ Content=’’{}{This is not a markup extension!}’’/>


System.Windows.Controls.ListBox listbox = new System.Windows.Controls.ListBox(); System.Windows.Controls.ListBoxItem item1 =
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="

System.Uri uri = new System.Uri("/WpfApplication1;component/MyWindow.xaml", System.UriKind.Relative);


<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="About WPF 4 Unleashed" SizeToContent="WidthAndHeight"
<Button MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" MinWidth="75" Margin="10">Help </Button >
<Button MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" MinWidth="75" Margin="10">Ok</Button >
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="About WPF 4 Unleashed" SizeToContent="WidthAndHeight"
<StackPanel TextElement.FontSize="30" TextElement.FontStyle="Italic" Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel TextElement.FontSize="30" TextElement.FontStyle="Italic" Orientation="Horizontal" HorizontalAlignment="Center">
<Button FlowDirection="LeftToRight" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Height="40" Background="Red
<Button FlowDirection="RightToLeft" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Height="40" Background="Ora
<Button DockPanel.Dock="Top" HorizontalAlignment="Right" Background="Red">1 (Top, Align=Right)</Button >
<Button DockPanel.Dock="Left" VerticalAlignment="Bottom" Background="Orange">2 (Left, Align=Bottom)</Button >
<Button DockPanel.Dock="Right" VerticalAlignment="Bottom" Background="Yellow">3 (Right , Align=Bottom)</Button >
<Button DockPanel.Dock="Bottom" HorizontalAlignment="Right" Background="Lime">4 (Bottom , Align=Right)</Button >
Grid.Row="0" Grid.Column="0" Background="Blue" Foreground="White" HorizontalContentAlignment="Center">Start Page </L
<Label Grid.Column="0" Background="Red" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">1

<Label Grid.Column="1" Background="Orange" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">2

<Label Grid.Column="2" Background="Yellow" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">3

<Label Grid.Column="0" Background="Red" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">1

<Label Grid.Column="1" Background="Orange" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">2

<Label Grid.Column="2" Background="Yellow" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">3


Background="{DynamicRes

Background="{DynamicRes

<!-- Row 0 contains a header , and rows 1 & 2 contain pane-specific content: -->
pane1PinImage.Source = new BitmapImage(new Uri("pinHorizontal.gif", UriKind.Relative));

pane2PinImage.Source = new BitmapImage(new Uri("pinHorizontal.gif", UriKind.Relative));


if ((e.KeyboardDevice.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt && (e.Key == Key.A || e.SystemKey == Key.A))

if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.Key == Key.A || e.SystemKey == Key.A))


fingerprint.RenderTransform = new TranslateTransform(point.Position.X, point.Position.Y);
void Canvas_ManipulationInertiaStarting(object sender , ManipulationInertiaStartingEventArgs e)
matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
matrix.RotateAt(e.DeltaManipulation.Rotation , e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
matrix.ScaleAt(e.DeltaManipulation.Scale.X, e.DeltaManipulation.Scale.Y, e.ManipulationOrigin.X, e.ManipulationOrigin.Y
void Grid_ManipulationInertiaStarting(object sender , ManipulationInertiaStartingEventArgs e)
this.CommandBindings.Add(new CommandBinding(Applic

this.CommandBindings.Add( new CommandBinding(ApplicationCommands.Help, HelpExecuted , HelpCanExecute));


causes App.g.cs to be generated and can be seen in Solution Explorer if you Show all files. System.Environment.GetCommandLineArgs
We can also bind to plain .net properties. but the source obj should implement the System.ComponentModel.INotifyPropertyChanged
Xxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyy
img’).hide(); chaining functions... $(’#popUp’).width(300).height(300); $(’#popUp’).width(300).height(300).text(’Hi!’).fadeIn(1000);

class=”error”¿User name required¡/span¿ .remove() $(’#popup’).remove(); .replaceWith() $(’#product101’).replaceWith(¡p¿Added


labels and arguments a feature of objective-C. in other langs. arrayInstance.replaceObjectsInRangeWithObjectsFromArrayRange(aRange,
[[NSMutableArray alloc] initWithCapacity:numberOfValuesRequired];

You might also like