本文整理汇总了C#中Rectangle.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.SetBinding方法的具体用法?C# Rectangle.SetBinding怎么用?C# Rectangle.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle.SetBinding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRangeRectangle
internal Rectangle GetRangeRectangle()
{
RangeRect = new Rectangle();
Binding fillBinding = new Binding();
fillBinding.Source = this;
fillBinding.Path = new PropertyPath("Fill");
RangeRect.SetBinding(Rectangle.FillProperty, fillBinding);
return RangeRect;
}
示例2: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
base.MeasureOverride(availableSize);
var rows = (int)Math.Ceiling(availableSize.Height / TileSize);
var cols = (int)Math.Ceiling(availableSize.Width / TileSize);
var cellCount = rows * cols;
if (this.Children.Count < cellCount || this.Children.Count > cellCount)
{
var missingItems = rows * cols - this.Children.Count;
for (int i = 0; i < missingItems; i++)
{
var rectangle = new Rectangle();
rectangle.SetBinding(Rectangle.FillProperty, new Binding() { Source = this, Path = new PropertyPath("Fill") });
this.Children.Add(rectangle);
}
if (missingItems < 0)
{
for (int i = 0; i > missingItems; i--)
{
this.Children.Remove(this.Children.Last());
}
}
}
foreach (var item in Children)
{
item.Measure(new Size(TileSize, TileSize));
}
return availableSize;
}
示例3: GetMeasureElement
internal Rectangle GetMeasureElement()
{
MeasureElement = new Rectangle();
Binding fillBinding = new Binding();
fillBinding.Source = this;
fillBinding.Path = new PropertyPath("Fill");
MeasureElement.SetBinding(Rectangle.FillProperty, fillBinding);
return MeasureElement;
}
示例4: OnApplyTemplate
public override void OnApplyTemplate()
#endif
{
base.OnApplyTemplate();
SampleSelector = GetTemplateChild(SampleSelectorName) as Grid;
SelectedHueColor = GetTemplateChild(SelectedHueColorName) as Rectangle;
var body = GetTemplateChild(BodyName) as Grid;
if (body != null)
{
_monitor = new MovementMonitor();
_monitor.Movement += _monitor_Movement;
_monitor.MonitorControl(body);
}
ColorSlider = GetTemplateChild(ColorSliderName) as ColorSlider;
if (ColorSlider != null)
{
if (Thumb == null)
Thumb = new ColorSliderThumb();
ColorSlider.ColorChanged += ColorSlider_ColorChanged;
if(SelectedHueColor != null)
{
#if WINDOWS_STORE || WINDOWS_PHONE_APP
var binding = new Windows.UI.Xaml.Data.Binding();
#elif WINDOWS_PHONE
var binding = new System.Windows.Data.Binding();
#endif
binding.Source = ColorSlider;
binding.Path = new PropertyPath("SolidColorBrush");
SelectedHueColor.SetBinding(Shape.FillProperty, binding);
}
}
}