开发者

Apply Control Template in XAML

开发者 https://www.devze.com 2023-01-21 14:47 出处:网络
This should be really simple.How do I apply a ControlTemplate to a Thumb in XAML? <UserControl.Resources>

This should be really simple. How do I apply a ControlTemplate to a Thumb in XAML?

<UserControl.Resources>
    <ControlTemplate x:Key="temp">
        <Ellipse Width="60" Height="30" Fill="Black"/>
    </ControlTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
    <TextBlock>Not Dragged</TextBlock>
    <Canvas x:Name="foo">
        <Thumb Width="150" Height="50" DragDelta开发者_如何学JAVA="Thumb_DragDelta" x:Name="simpleDrag">

        </Thumb>
        <TextBlock>Dragged (hopefull)</TextBlock>
    </Canvas>
</Grid>

I can't figure out how to apply the "temp" template to the Thumb. Thanks!


You'd use the Template property:

<Thumb Width="150" ... Template="{StaticResource temp}" />
0

精彩评论

暂无评论...
验证码 换一张
取 消