What are the properties that reduce the performance of 3D graphics rendering?
The following are some of the properties when used in a 3D graphics, reduces the performance of 3D graphics rendering. Brushes. ClipToBounds property is set to true. IsHitTestVisible property is set to True. More models of Geometry3D are created. Live text is added in a 3D scene. BitmapEffect is applied.
How can I style a Separator used as a Menu Item ?
Separator controls inside Menu elements appear differently from Separator controls outside a Menu. When you create a Menu with a Separator, the control automatically applies the Style identified by the SeparatorStyleKey property. Styles are placed in resource dictionaries and are searched for by their keys. To change the Style of a Separator inside a Menu, you must use the SeparatorStyleKey property to create your new Style. The following example demonstrates this. [XAML] <Style x:Key='{x:Static MenuItem.SeparatorStyleKey}’ TargetType=’Separator’> <Setter Property=’OverridesDefaultStyle’ Value=’true’ /> <Setter Property=’Template’> <Setter.Value> <ControlTemplate TargetType='{x:Type Separator}’> <Border Width=’30’ Height=’4′ Margin=’4′ Background=’Red’/> </ControlTemplate> </Setter.Value> </Setter> </Style>
How do I access / edit the metadata associated with an Image ?
The ‘BitmapMetaData’ class provides metadata information contained by the image. This metadata can be one metadata schema or a combination of different schemes. WPF inherently supports the following image schemas: ExchangableImageFile (Exif). PNG Textual Data. ImageFileDirectory (IFD). InternationalPressTelecommunicationsCouncil (IPTC). ExtensibleMarkupLanguage (XMP). [C#] Stream pngStream = new System.IO.FileStream(‘winter.png’, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); BitmapFrame pngFrame = pngDecoder.Frames[0]; InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter(); if (pngInplace.TrySave() == true) { pngInplace.SetQuery(‘/Text/Author’, ‘Me’); } pngStream.Close();
How to rotate an image ?
Use the TransformedBitmap element to rotate an image. [XAML] <Image Width=’200′ Height=’200′> <Image.Source> <TransformedBitmap Source=’C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg’> <TransformedBitmap.Transform> <RotateTransform Angle=’270′ /> </TransformedBitmap.Transform> </TransformedBitmap> </Image.Source> </Image>
How can I convert an Image to grayscale ?
This can be done by using the ‘FormatConvertedBitmap’ class. The image is converted to the spcified PixedFormat type. The following code snippet shows the conversion of an image to grayscale. [XAML] <Image Width=’200′ Height=’200′ > <Image.Source> <FormatConvertedBitmap Source=’C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg’ DestinationFormat=’Gray4′ /> </Image.Source> </Image>