本文整理汇总了C#中ScatterViewItem.FindVisualChild方法的典型用法代码示例。如果您正苦于以下问题:C# ScatterViewItem.FindVisualChild方法的具体用法?C# ScatterViewItem.FindVisualChild怎么用?C# ScatterViewItem.FindVisualChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScatterViewItem
的用法示例。
在下文中一共展示了ScatterViewItem.FindVisualChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinishManipulation
/// <summary>
/// Finishes the manipulation.
/// </summary>
/// <param name="svi">The ItemProxy.</param>
private void FinishManipulation(ScatterViewItem svi)
{
RiverItemState state = GetState(svi);
if (state == null)
{
return;
}
if (state.RemovedSize == Size.Empty)
{
RiverItemBase riverItem = svi.FindVisualChild<RiverItemBase>();
if (riverItem != null)
{
state.AnimateToRemovedSizeBeginTime = DateTime.Now;
state.IsAnimatingToRemovedSize = true;
Thickness padding = Plane.GetPlaneFrontPadding(svi);
RiverSize riverSize = riverItem.Removed();
state.RemovedSize = riverSize.RemovedSize;
state.MinSize = riverSize.MinSize;
svi.MaxWidth = riverSize.MaxSize.Width + padding.Left + padding.Right;
svi.MaxHeight = riverSize.MaxSize.Height + padding.Top + padding.Bottom;
Audio.Instance.PlayCue("streamItem_tapRelease");
}
}
if (!svi.AreAnyTouchesCapturedWithin)
{
BeginIdleTimeout(svi);
}
}
示例2: ReturnItemProxyToRiver
/// <summary>
/// Returns an SVI to the river.
/// </summary>
/// <param name="svi">The ItemProxy.</param>
private void ReturnItemProxyToRiver(ScatterViewItem svi)
{
RiverItemState state = GetState(svi);
if (state == null)
{
return;
}
CancelIdleTimeout(svi);
if (!state.IsRemovedFromRiver)
{
return;
}
Audio.Instance.PlayCue("streamItem_close");
svi.CanScale = false;
svi.MinHeight = GridCellSize.Height;
svi.MinWidth = GridCellSize.Width;
state.IsAnimatingBackToRiver = true;
state.Svi.IsHitTestVisible = false;
state.IsAnimatingToRemovedSize = false;
state.IsAnimatingToContactOrientation = false;
state.AnimateBackBeginTime = DateTime.Now;
state.ReturnHorizontalOffset = _cumulativeScrollChange;
ScatterFlip.SetIsFlipped(svi, false);
RiverItemBase riverItem = svi.FindVisualChild<RiverItemBase>();
if (riverItem != null)
{
riverItem.Added();
}
}
示例3: ItemProxy_PreviewTouchDown
/// <summary>
/// Handles the PreviewContactDown event of the ItemProxy control.
/// If a ItemProxy can't move, block the contact so that a manipulation doesn't begin. Otherwise, create an SVI from the proxy.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Input.TouchEventArgs"/> instance containing the event data.</param>
private void ItemProxy_PreviewTouchDown(object sender, TouchEventArgs e)
{
ItemProxy proxy = sender as ItemProxy;
RiverItemState state = GetState(proxy);
if (!proxy.CanMove || state.IsAnimatingToContactOrientation || state.IsAnimatingToRemovedSize || state.IsAnimatingBackToRiver)
{
e.Handled = true;
return;
}
if ((e.OriginalSource as FrameworkElement).FindVisualParent<Button>() != null)
{
// Ignore if an admin button is pressed.
return;
}
// Create the SVI and set its position and orientation.
ScatterViewItem svi = new ScatterViewItem();
_scatterView.Items.Add(svi);
state.Svi = svi;
svi.Style = state.ItemStyle;
svi.MinHeight = proxy.MinHeight;
svi.MinWidth = proxy.MinWidth;
svi.Center = proxy.Center;
svi.Orientation = proxy.Orientation;
svi.CanScale = false;
svi.CanRotate = false;
// Set the SVI size.
bool isPortrait = state.RowSpan > state.ColumnSpan;
double itemWidth = state.ColumnSpan * GridCellSize.Width;
double itemHeight = state.RowSpan * GridCellSize.Height;
itemWidth += Plane.GetPlaneFrontPadding(svi).Left + Plane.GetPlaneFrontPadding(svi).Right;
itemHeight += Plane.GetPlaneFrontPadding(svi).Top + Plane.GetPlaneFrontPadding(svi).Bottom;
svi.Width = isPortrait ? itemHeight : itemWidth;
svi.Height = isPortrait ? itemWidth : itemHeight;
// Hook events.
svi.ContainerActivated += ScatterViewItem_Activated;
svi.ContainerManipulationDelta += ScatterViewItem_ScatterManipulationDelta;
svi.ContainerDeactivated += ScatterViewItem_Deactivated;
svi.ContainerManipulationCompleted += ScatterViewItem_ScatterManipulationCompleted;
TouchChangedEvents.AddAreAnyTouchesCapturedWithinChangedHandler(svi, new RoutedEventHandler(ScatterViewItem_AreAnyTouchesCapturedWithinChanged));
svi.AddHandler(RiverItemBase.FlipRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_FlipRequested));
svi.AddHandler(RiverItemBase.CloseRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_CloseRequested));
svi.Unloaded += (a, b) =>
{
// Unhook events on unload.
svi.ContainerActivated -= ScatterViewItem_Activated;
svi.ContainerManipulationDelta -= ScatterViewItem_ScatterManipulationDelta;
svi.ContainerDeactivated -= ScatterViewItem_Deactivated;
svi.ContainerManipulationCompleted -= ScatterViewItem_ScatterManipulationCompleted;
TouchChangedEvents.RemoveAreAnyTouchesCapturedWithinChangedHandler(svi, new RoutedEventHandler(ScatterViewItem_AreAnyTouchesCapturedWithinChanged));
svi.RemoveHandler(RiverItemBase.FlipRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_FlipRequested));
svi.RemoveHandler(RiverItemBase.CloseRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_CloseRequested));
};
svi.Loaded += (a, b) =>
{
// Populate with data when loaded.
RiverItemBase proxyItem = proxy.FindVisualChild<RiverItemBase>();
RiverItemBase sviItem = svi.FindVisualChild<RiverItemBase>();
sviItem.RenderData(state, proxyItem.DataContext);
proxy.Visibility = Visibility.Hidden;
};
// Steal the touch from the proxy.
svi.UpdateLayout();
svi.CaptureTouch(e.TouchDevice);
}