Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Controls / BooleanToVisibilityConverter.cs / 1 / BooleanToVisibilityConverter.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Windows; using System.Windows.Media; using System.Windows.Data; using System.Globalization; using System.Collections.Generic; using MS.Internal.Controls; namespace System.Windows.Controls { ////// Convert between boolean and visibility /// [Localizability(LocalizationCategory.NeverLocalize)] public sealed class BooleanToVisibilityConverter : IValueConverter { ////// Convert bool or Nullable<bool> to Visibility /// /// bool or Nullable<bool> /// Visibility /// null /// null ///Visible or Collapsed public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool bValue = false; if (value is bool) { bValue = (bool)value; } else if (value is Nullable) { Nullable tmp = (Nullable )value; bValue = tmp.HasValue ? tmp.Value : false; } return (bValue) ? Visibility.Visible : Visibility.Collapsed; } /// /// Convert Visibility to boolean /// /// /// /// /// ///public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (value is Visibility) { return (Visibility)value == Visibility.Visible; } else { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WhileDesigner.xaml.cs
- AuthenticationServiceManager.cs
- PagesSection.cs
- Mutex.cs
- SiteMapDataSourceView.cs
- UnmanagedMemoryStream.cs
- ValidatorCompatibilityHelper.cs
- MutexSecurity.cs
- RelationshipEntry.cs
- WizardStepBase.cs
- CroppedBitmap.cs
- WindowsFormsLinkLabel.cs
- CodeMemberProperty.cs
- ButtonChrome.cs
- InheritablePropertyChangeInfo.cs
- WebPartHeaderCloseVerb.cs
- DebugHandleTracker.cs
- BitConverter.cs
- MemberAssignment.cs
- ConfigurationCollectionAttribute.cs
- indexingfiltermarshaler.cs
- BindableTemplateBuilder.cs
- FixedSOMFixedBlock.cs
- Matrix3DConverter.cs
- DataSourceNameHandler.cs
- LinqDataSourceEditData.cs
- XmlNodeChangedEventArgs.cs
- SchemaCollectionCompiler.cs
- GridViewColumnHeader.cs
- PrintingPermissionAttribute.cs
- TableLayoutRowStyleCollection.cs
- AnimationException.cs
- AnnotationComponentChooser.cs
- Stack.cs
- ReflectionServiceProvider.cs
- SharedConnectionInfo.cs
- base64Transforms.cs
- StatusBarItem.cs
- Polyline.cs
- TextServicesHost.cs
- SubpageParagraph.cs
- DrawingVisual.cs
- FixedSOMSemanticBox.cs
- DiscoveryClientDuplexChannel.cs
- ReferentialConstraint.cs
- MultipartContentParser.cs
- HideDisabledControlAdapter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ActiveXHost.cs
- ColumnResizeAdorner.cs
- ExtendedPropertyDescriptor.cs
- PeerNameResolver.cs
- PathFigure.cs
- SafeCryptoHandles.cs
- OracleDataAdapter.cs
- ProfessionalColorTable.cs
- PowerModeChangedEventArgs.cs
- ObjectListCommand.cs
- ColorAnimation.cs
- SqlResolver.cs
- BaseParser.cs
- COSERVERINFO.cs
- Point4D.cs
- SecuritySessionFilter.cs
- SizeConverter.cs
- XmlTextReader.cs
- CuspData.cs
- EventLogReader.cs
- StyleHelper.cs
- ListViewCancelEventArgs.cs
- PrincipalPermission.cs
- SelectionEditingBehavior.cs
- WindowsFormsHelpers.cs
- DataControlFieldHeaderCell.cs
- CompilerInfo.cs
- StrokeRenderer.cs
- PrincipalPermission.cs
- IsolationInterop.cs
- SynchronizedPool.cs
- Sorting.cs
- GlyphInfoList.cs
- SparseMemoryStream.cs
- ColorDialog.cs
- EditorZoneBase.cs
- ReadOnlyDataSource.cs
- InstalledVoice.cs
- NetworkInterface.cs
- Helpers.cs
- SplitterPanel.cs
- MeasurementDCInfo.cs
- IndentedTextWriter.cs
- InheritanceAttribute.cs
- WebPartMenu.cs
- RepeaterItem.cs
- Stack.cs
- DefaultAuthorizationContext.cs
- CubicEase.cs
- DependencyObjectType.cs
- OdbcConnectionPoolProviderInfo.cs
- CodeTryCatchFinallyStatement.cs