templatebinding

How to access getter/setter accessors from angular 4 in template binding?

我与影子孤独终老i 提交于 2020-02-21 13:47:25
问题 Lets say I have the following getter/setter methods get next() { console.log(this.people[this._index], this._index); return this.people[this._index]; } set next(i: any) { this._index = (+i) + 1; this._index = (+i) % this.people.length; } and I want to call this in the following way: <ng-template ngFor let-person="$implicit" [ngForOf]="people" let-i=index let-last=last> <app-card [cardItem]="people[i]" [nextCard]="next(i)"></app-card> </ng-template> PS: Think of this as circular array. Where

How to access getter/setter accessors from angular 4 in template binding?

老子叫甜甜 提交于 2020-02-21 13:46:51
问题 Lets say I have the following getter/setter methods get next() { console.log(this.people[this._index], this._index); return this.people[this._index]; } set next(i: any) { this._index = (+i) + 1; this._index = (+i) % this.people.length; } and I want to call this in the following way: <ng-template ngFor let-person="$implicit" [ngForOf]="people" let-i=index let-last=last> <app-card [cardItem]="people[i]" [nextCard]="next(i)"></app-card> </ng-template> PS: Think of this as circular array. Where

Using TemplateBinding in ObjectAnimationUsingKeyFrames

戏子无情 提交于 2020-01-30 09:05:20
问题 I try to set the background color of a control when mouse is over it. I try to do it via the visual state manager. I was able to get the following code running: <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Control.Background" Storyboard.TargetName="BorderBackground"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <SolidColorBrush Color="#FF123456" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> But i do not want

Using TemplateBinding in ObjectAnimationUsingKeyFrames

浪尽此生 提交于 2020-01-30 09:05:20
问题 I try to set the background color of a control when mouse is over it. I try to do it via the visual state manager. I was able to get the following code running: <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Control.Background" Storyboard.TargetName="BorderBackground"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <SolidColorBrush Color="#FF123456" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> But i do not want

Animating SolidColorBrush in Background

烈酒焚心 提交于 2020-01-07 03:58:08
问题 I am trying to create a simple button style, that will change the opacity of the background from 0.0 to 1.0 on mouse over (and vice versa). I am creating a template for said button and I am binding all the properties in the template. It all works properly except the SolidColorBrush in background, that I can not bind to the template binding. I've seen some mentions of TemplateBinding not being the right one due to contexts, but I am not able to find another solution. I suspect, there might be

c# uwp tooltip placement property not updating

江枫思渺然 提交于 2020-01-04 14:09:18
问题 In C# UWP I am creating custom tooltip style. I have changed the default style of tooltip as below. <Style TargetType="ToolTip"> <Setter Property="Foreground" Value="White" /> <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeHighBrush}" /> <Setter Property="BorderThickness" Value="{ThemeResource ToolTipBorderThemeThickness}" /> <Setter Property="FontSize" Value

TemplateBindings in Custom Controls

血红的双手。 提交于 2020-01-03 15:58:14
问题 I'm just mucking about with custom controls in silverlight and for the life of me i can't get the TemplateBindings to work. Can someone give this reduced version a once over to see if I'm missing something. So my ControlTemplate in the generic.xaml looks like <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:NumericStepperControl;assembly=NumericStepperControl"> <Style

TemplateBinding fails when the target is an ImageBrush.ImageSource

倾然丶 夕夏残阳落幕 提交于 2020-01-02 05:34:31
问题 Why does TemplateBinding seems to fail in this specific case? Take a basic extended button: public class IconButton : Button { public ImageSource Icon { get { return (ImageSource)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Icon", typeof(ImageSource), typeof(IconButton), new PropertyMetadata(null)); public IconButton() { DefaultStyleKey = typeof(IconButton); } } The control template

How to Bind a specific ObservableCollection item's property to a CustomControl's ControlTemplate

穿精又带淫゛_ 提交于 2019-12-23 05:12:33
问题 I have a custom control with an observable-collection of "states", sort of like a multiple-state-button. Only the necessary code is here to avoid confusion: public class MyMultiStateBtn : ItemsControl { MyMultiStateBtn() { m_states = new ObservableCollection<MyState>(); } private ObservableCollection<MyState> m_states; public System.Collections.ObjectModel.ObservableCollection<MyState> States { get { return m_states; } set { m_states = value; } } } The "MyState" class (the objets in the

Is it possible to use compiled binding (x:Bind) with Relative Source, Templated Parent

夙愿已清 提交于 2019-12-21 22:33:55
问题 I'd like to do something like this is a Style: Value="{x:Bind MyCustomDependencyProp, RelativeSource={RelativeSource TemplatedParent}}" Is that possible? Are there any performance benefits? Using TemplateBinding does not seem to work, with a custom DependencyProperty as described elsewhere here on SO: https://stackoverflow.com/a/8657453 回答1: RelativeSource (with x:Bind) is not supported, therefore this particular scenario won't be possible (at the moment, at least). Using TemplateBinding or