}
);
+ var paddingContainer = new ViewContainer<ImageButton>(Test.ImageButton.Padding,
+ new ImageButton
+ {
+ Source = "oasissmall.jpg",
+ BackgroundColor = Color.Red,
+ Padding = new Thickness(20, 30, 60, 15)
+ }
+ );
+
InitializeElement(aspectFillContainer.View);
InitializeElement(aspectFitContainer.View);
Add(corderRadiusContainer);
Add(imageContainer);
Add(pressedContainer);
+ Add(paddingContainer);
}
}
}
\ No newline at end of file
Clicked,
Command,
Image,
- Pressed
+ Pressed,
+ Padding
}
public enum ImageSource
if (Element.BorderWidth != 0)
UpdateBorderWidth();
+ if (Element.IsSet(Button.PaddingProperty))
+ UpdatePadding();
+
UpdateFont();
}
else if (e.PropertyName == Button.BorderColorProperty.PropertyName)
UpdateBorderColor();
else if (e.PropertyName == Button.BorderWidthProperty.PropertyName)
+ {
UpdateBorderWidth();
+ UpdatePadding();
+ }
+ else if (e.PropertyName == Button.PaddingProperty.PropertyName)
+ UpdatePadding();
}
void HandleButtonClick(object sender, RoutedEventArgs e)
_isDisposed = true;
base.Dispose(disposing);
}
+
+ void UpdatePadding()
+ {
+ Control.Padding = new WThickness(
+ Element.Padding.Left,
+ Element.Padding.Top,
+ Element.Padding.Right,
+ Element.Padding.Bottom
+ );
+ }
}
-}
\ No newline at end of file
+}
await TryUpdateSource().ConfigureAwait(false);
UpdateAspect();
+
+ if (Element.IsSet(Button.PaddingProperty))
+ UpdatePadding();
}
}
else if (e.PropertyName == ImageButton.BorderColorProperty.PropertyName)
UpdateBorderColor();
else if (e.PropertyName == ImageButton.BorderWidthProperty.PropertyName)
+ {
UpdateBorderWidth();
+ UpdatePadding();
+ }
else if (e.PropertyName == ImageButton.AspectProperty.PropertyName)
UpdateAspect();
+ else if (e.PropertyName == Button.PaddingProperty.PropertyName)
+ UpdatePadding();
}
protected override void Dispose(bool disposing)
Control.VerticalAlignment = System.Windows.VerticalAlignment.Top;
}
}
+
+ void UpdatePadding()
+ {
+ Control.Padding = new WThickness(
+ Element.Padding.Left,
+ Element.Padding.Top,
+ Element.Padding.Right,
+ Element.Padding.Bottom
+ );
+ }
}
}