ivanik62
New member
- Joined
- Aug 30, 2024
- Messages
- 2
- Programming Experience
- Beginner
good morning everyone, sorry but I'm a very very newbie and I don't even know how to ask the right questions.
I wanted to ask if there is a possibility to create a binding for the shadow properties of a control (eg. a button)
Something that could look like this.
Class:
XAML:
MainPage:
As posted it doesn't work
Thanks to everyone.
I wanted to ask if there is a possibility to create a binding for the shadow properties of a control (eg. a button)
Something that could look like this.
Class:
C#:
public class Shadows
{
public string Brush { get; set; } = "Black";
public string Offset { get; set; } = "50,50";
public string Radius { get; set; } = "10";
public string Opacity { get; set; } = "0.7";
}
XAML:
C#:
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
BorderColor="DarkBlue"
BorderWidth="1"
HorizontalOptions="Fill" >
<Button.Shadow>
<Shadow
Brush="{Binding ControlShadow.Brush}"
Offset="{Binding ControlShadow.Offset}"
Radius="{Binding ControlShadow.Radius}"
Opacity="{Binding ControlShadow.Opacity}" />
</Button.Shadow>
</Button>
MainPage:
C#:
public partial class MainPage : ContentPage
{
int count = 0;
public Shadows ControlShadow { get; set; }
public MainPage()
{
InitializeComponent();
ControlShadow = new Shadows();
BindingContext = this;
}
}
As posted it doesn't work
Thanks to everyone.