template-control

Create custom Shape Control in UWP (Universal Windows Apps), Windows 10

夙愿已清 提交于 2019-12-21 23:04:57
问题 I want to create a custom Shape control, that paints different shapes like Polygon , Ellipse , Rectangle , etc, depending on some custom properties. I was able to create a custom template control ColorShape like this: <Style TargetType="local:CustomShape"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CustomShape"> <ContentControl x:Name="shapeParent"> </ContentControl> </ControlTemplate> </Setter.Value> </Setter> </Style> And then, override the

Create custom Shape Control in UWP (Universal Windows Apps), Windows 10

懵懂的女人 提交于 2019-12-04 17:02:58
I want to create a custom Shape control, that paints different shapes like Polygon , Ellipse , Rectangle , etc, depending on some custom properties. I was able to create a custom template control ColorShape like this: <Style TargetType="local:CustomShape"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CustomShape"> <ContentControl x:Name="shapeParent"> </ContentControl> </ControlTemplate> </Setter.Value> </Setter> </Style> And then, override the OnTemplateChanged method, and insert a corresponding Shape control inside the shapeParent ContentControl But what I'd