本文整理汇总了C#中UIElement.ClearValue方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.ClearValue方法的具体用法?C# UIElement.ClearValue怎么用?C# UIElement.ClearValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement.ClearValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnVisualRemoved
protected override void OnVisualRemoved(UIElement elt)
{
Viewport2DVisual3D model = elt.GetValue(LinkedModelProperty) as Viewport2DVisual3D;
_modelContainer.Children.Remove(model);
LoginGrid loginGrid = (LoginGrid)model.Visual;
loginGrid.imgMoveToLeft.MouseDown -= MoveToLeft;
loginGrid.imgMoveToRight.MouseDown -= MoveToRight;
model.ClearValue(LinkedElementProperty);
elt.ClearValue(LinkedModelProperty);
SelectedIndex = 0;
// Update SelectedIndex if needed
if (SelectedIndex >= 0 && SelectedIndex < VisibleChildrenCount)
{
ReflowItems();
}
else
{
SelectedIndex = Math.Max(0, Math.Min(SelectedIndex, VisibleChildrenCount - 1));
}
}
示例2: OnVisualRemoved
protected override void OnVisualRemoved(UIElement elt)
{
Viewport2DVisual3D model = elt.GetValue(LinkedModelProperty) as Viewport2DVisual3D;
_modelContainer.Children.Remove(model);
model.ClearValue(LinkedElementProperty);
elt.ClearValue(LinkedModelProperty);
SelectedIndex = 0;
// Update SelectedIndex if needed
if (SelectedIndex >= 0 && SelectedIndex < VisibleChildrenCount)
{
ReflowItems();
}
else
{
SelectedIndex = Math.Max(0, Math.Min(SelectedIndex, VisibleChildrenCount - 1));
}
//load current tab
Viewport2DVisual3D newSelectedModel = (Viewport2DVisual3D)_modelContainer.Children[SelectedIndex];
ListBoxItem item = (ListBoxItem)newSelectedModel.GetValue(LinkedElementProperty);
RaiseTabLoadedEvent((Tab)item.Content);
}
示例3: OnVisualRemoved
private void OnVisualRemoved(UIElement elt)
{
var model = elt.GetValue(LinkedModelProperty) as ModelUIElement3D;
if (model != null)
{
_modelContainer.Children.Remove(model);
model.ClearValue(LinkedElementProperty);
}
elt.ClearValue(LinkedModelProperty);
}
示例4: EndChildExit
private void EndChildExit( UIElement child, ChildState state )
{
// raise the ChildExited event
state.HasExitCompleted = true;
AnimationPanel.RaiseChildExitedEvent( child, child );
// remove the visual child relationship
if( this.ExitingChildren.Contains( child ) )
{
this.IsRemovingInternalChild = true;
try
{
if( _switchParent != null )
{
_switchParent.RemoveVisualChildInternal( child );
}
else
{
this.RemoveVisualChild( child );
}
}
finally
{
this.IsRemovingInternalChild = false;
}
this.ExitingChildren.Remove( child );
}
child.ClearValue( AnimationPanel.ChildStatePropertyKey );
}
示例5: HandleGeneratedContainerPreparation
private void HandleGeneratedContainerPreparation(
UIElement container,
int containerIndex,
bool isNewlyRealized,
bool delayDataContext )
{
#if DEBUG
TableflowViewItemsHost.SetRealizedIndex( container, containerIndex );
#endif //DEBUG
try
{
TableflowViewItemsHost.SetShouldDelayDataContext(
container, ( !this.PreventOpacityAnimation && this.IsDeferredLoadingEnabledCache && delayDataContext ) );
if( isNewlyRealized )
{
// We must prepare the container if the container preparation
// should not be delayed or if we've been ask to prepare it (from
// a keyboard navigation for example)
this.PrepareContainer( container );
}
// We must set those properties AFTER calling PrepareContainer since PrepareContainer
// will set the ItemContainerStyle which could affect the Height properties. In our case,
// we want to override those properties so that our layout is ok.
container.SetValue( FrameworkElement.MinHeightProperty, m_containerHeight );
container.SetValue( FrameworkElement.MaxHeightProperty, m_containerHeight );
container.SetValue( FrameworkElement.HeightProperty, m_containerHeight );
// In the case of HeaderFooterItems, we also want to set the Height properties of the inner
// container if that container is a Row or a descendant.
HeaderFooterItem headerFooterItem = container as HeaderFooterItem;
if( ( headerFooterItem != null )
&& ( headerFooterItem.Container != null )
&& ( this.ContainerIsRow( container ) ) )
{
headerFooterItem.Container.SetValue( FrameworkElement.MinHeightProperty, m_containerHeight );
headerFooterItem.Container.SetValue( FrameworkElement.MaxHeightProperty, m_containerHeight );
headerFooterItem.Container.SetValue( FrameworkElement.HeightProperty, m_containerHeight );
}
}
finally
{
container.ClearValue( TableflowViewItemsHost.ShouldDelayDataContextProperty );
}
}
示例6: RecycleContainer
private void RecycleContainer( ICustomItemContainerGenerator generator, int containerIndex, UIElement container )
{
if( ( generator != null ) && ( containerIndex != -1 ) )
{
try
{
GeneratorPosition position = generator.GeneratorPositionFromIndex( containerIndex );
generator.Remove( position, 1 );
}
catch
{
Debug.Fail( "Unable to remove container for containerIndex " + containerIndex );
}
}
#if DEBUG
TableflowViewItemsHost.SetRealizedIndex( container, -1 );
#endif //DEBUG
TableflowViewItemsHost.ClearIsSticky( container );
container.ClearValue( UIElement.ClipProperty );
this.DisableElementNavigation( container );
this.FreeRowSelector( container );
m_layoutedContainersToRecycle.Add( container );
}
示例7: SetFixedTranslateTransform
internal static void SetFixedTranslateTransform( UIElement element, bool canScrollHorizontally )
{
if( element == null )
throw new ArgumentNullException( "element" );
ScrollViewer parentScrollViewer = TableViewScrollViewer.GetParentScrollViewer( element ) as ScrollViewer;
if( parentScrollViewer != null )
{
Transform fixedTransform = TableViewScrollViewer.GetStoredFixedTransform( parentScrollViewer );
Debug.Assert( fixedTransform != null );
if( canScrollHorizontally )
{
if( element.RenderTransform == fixedTransform )
{
element.ClearValue( UIElement.RenderTransformProperty );
}
}
else
{
element.RenderTransform = fixedTransform;
}
}
}
示例8: PrepareContainer
private void PrepareContainer( UIElement container )
{
container.ClearValue( UIElement.VisibilityProperty );
var dataItemStore = Xceed.Wpf.DataGrid.CustomItemContainerGenerator.GetDataItemProperty( container );
if( ( dataItemStore == null ) || dataItemStore.IsEmpty )
return;
var dataItem = dataItemStore.Data;
if( dataItem == null )
return;
// Prepare the container.
this.ParentDataGridControl.PrepareItemContainer( container, dataItem );
}
示例9: ShowAdorner
private static void ShowAdorner(UIElement targetElement, bool show, bool retry = true)
{
if (targetElement == null)
{
return;
}
var adornerLayer = AdornerLayer.GetAdornerLayer(targetElement);
if (adornerLayer == null)
{
if (retry)
{
targetElement.Dispatcher.BeginInvoke(
DispatcherPriority.Loaded,
new Action(() => ShowAdorner(targetElement, show, false)));
}
return;
}
var adorner = targetElement.ReadLocalValue(AdornerProperty) as TemplatedAdorner;
if (show && adorner == null)
{
var validationTemplate = GetTemplate(targetElement);
if (validationTemplate != null)
{
adorner = new TemplatedAdorner(targetElement, validationTemplate);
adornerLayer.Add(adorner);
targetElement.SetValue(AdornerProperty, adorner);
}
}
else if (!show && adorner != null)
{
adorner.ClearChild();
adornerLayer.Remove(adorner);
targetElement.ClearValue(AdornerProperty);
}
}
示例10: SetViewportPosition
private static void SetViewportPosition(UIElement element, MapBase parentMap, Location location)
{
Point viewportPosition;
if (parentMap != null && location != null)
{
var mapPosition = parentMap.MapTransform.Transform(location, parentMap.Center.Longitude); // nearest to center longitude
viewportPosition = parentMap.ViewportTransform.Transform(mapPosition);
element.SetValue(ViewportPositionProperty, viewportPosition);
}
else
{
viewportPosition = new Point();
element.ClearValue(ViewportPositionProperty);
}
var translateTransform = element.RenderTransform as TranslateTransform;
if (translateTransform == null)
{
var transformGroup = element.RenderTransform as TransformGroup;
if (transformGroup == null)
{
translateTransform = new TranslateTransform();
element.RenderTransform = translateTransform;
}
else
{
if (transformGroup.Children.Count > 0)
{
translateTransform = transformGroup.Children[transformGroup.Children.Count - 1] as TranslateTransform;
}
if (translateTransform == null)
{
translateTransform = new TranslateTransform();
transformGroup.Children.Add(translateTransform);
}
}
}
translateTransform.X = viewportPosition.X;
translateTransform.Y = viewportPosition.Y;
}
示例11: UnregisterToolTip
private static void UnregisterToolTip(UIElement owner)
{
if (owner.GetValue(ToolTipObjectProperty) == null)
{
return;
}
if (owner is FrameworkElement)
{
((FrameworkElement)owner).Unloaded -= FrameworkElementUnloaded;
}
owner.MouseEnter -= OnElementMouseEnter;
owner.MouseLeave -= OnElementMouseLeave;
var toolTip = (ToolTip)owner.GetValue(ToolTipObjectProperty);
if (toolTip.IsOpen)
{
toolTip.IsOpen = false;
}
toolTip.SetOwner(null);
owner.ClearValue(ToolTipObjectProperty);
if (elementsAndToolTips.ContainsKey(owner))
{
elementsAndToolTips.Remove(owner);
}
}
示例12: UnregisterToolTip
private static void UnregisterToolTip(UIElement owner)
{
owner.MouseEnter -= OnElementMouseEnter;
owner.MouseLeave -= OnElementMouseLeave;
if (owner.GetValue(ToolTipObjectProperty) == null) return;
var tip = (ToolTip) owner.GetValue(ToolTipObjectProperty);
if (tip.IsOpen)
tip.IsOpen = false;
owner.ClearValue(ToolTipObjectProperty);
}
示例13: OnVisualRemoved
private void OnVisualRemoved(UIElement elt)
{
ModelUIElement3D model = elt.GetValue(LinkedModelProperty) as ModelUIElement3D;
_modelContainer.Children.Remove(model);
model.ClearValue(LinkedElementProperty);
elt.ClearValue(LinkedModelProperty);
// Update SelectedIndex if needed
if (SelectedIndex >= 0 && SelectedIndex < VisibleChildrenCount)
{
ReflowItems();
}
else
{
SelectedIndex = Math.Max(0, Math.Min(SelectedIndex, VisibleChildrenCount - 1));
}
}