本文整理汇总了C#中System.Windows.Controls.Panel.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.SetValue方法的具体用法?C# Panel.SetValue怎么用?C# Panel.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Panel
的用法示例。
在下文中一共展示了Panel.SetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateForHanyu
private FrameworkElement CreateForHanyu( Word word, bool showEnglish = false )
{
var chars = WordDatabase.Characters( word );
_mainPanel = CreateStackPanel(
CreateTextBlock( "SimSun", 30,
chars.Select( c => new Run {
Text = c.Hanyu,
Foreground = new SolidColorBrush( ToneColor( c.Pinyin ) )
} ).ToArray( ) ),
CreateTextBlock( "Times New Roman", 20,
chars.Select( c => new Run {
Text = " " + c.PinyinDiacritics + " ",
Foreground = new SolidColorBrush( ToneColor( c.Pinyin ) )
} ).ToArray( ) ),
CreateEnglishPanel( showEnglish ? word.ShortEnglish : "" ) );
_mainPanel.SetValue( ToolTipService.ShowDurationProperty, 60000 );
return _mainPanel;
}
示例2: SetIsFieldGroup
public static void SetIsFieldGroup(Panel target, bool isFieldGroup)
{
target.SetValue(IsFieldGroupProperty, isFieldGroup);
}
示例3: InitializeHost
/// <summary>
/// Initialize the panel hosting control presenters to duplicate (creating a virtual carousel)
/// </summary>
/// <param name="panel">Carousel panel</param>
/// <param name="presenter">Main control presenter</param>
/// <param name="left">Control to add to the left</param>
/// <param name="right">Control to add to the right</param>
/// <param name="pad">Number of empty padding pixels to add to 'left' and 'right'</param>
private void InitializeHost(Panel panel, FrameworkElement presenter, FrameworkElement left, FrameworkElement right, double pad)
{
// reset/initialize layout with dummy values
if (panel.Children.Count == 1)
{
panel.Children.Insert(0, new Rectangle());
panel.Children.Add(new Rectangle());
}
panel.SetValue(Canvas.LeftProperty, 0.0);
// insert items ?
if (Items.Count > 0)
{
WriteableBitmap bitmap;
Image image;
int width;
int height;
// duplicate left
width = (int)(left.ActualWidth + pad);
height = (int)left.ActualHeight;
bitmap = new WriteableBitmap(width, height);
bitmap.Render(left, null);
bitmap.Invalidate();
image = new Image();
image.Source = bitmap;
panel.Children[0] = image;
double offset = bitmap.PixelWidth;
// duplicate right
width = (int)(right.ActualWidth + pad);
height = (int)right.ActualHeight;
bitmap = new WriteableBitmap(width, height);
bitmap.Render(right, new TranslateTransform() { X = pad });
bitmap.Invalidate();
image = new Image();
image.Source = bitmap;
panel.Children[2] = image;
// adjust panel position
panel.SetValue(Canvas.LeftProperty, -offset);
}
}