开发者

User control or custom control for this design?

开发者 https://www.devze.com 2022-12-31 11:22 出处:网络
If I开发者_C百科 want to create a button control like that, is it supposed to be a User Control or a Custom Control? Iam not sure maybe something else? Ideally I want to be able style/animate the m

User control or custom control for this design?

If I开发者_C百科 want to create a button control like that, is it supposed to be a User Control or a Custom Control? I am not sure maybe something else? Ideally I want to be able style/animate the main button and the inner button separately; also obviously Ill need to process their events separately. These buttons will be created at run-time and Ill need to set the icons dynamically.


I'd suggest a user control. You can still create your basic styling in xaml and use code for the dynamic stuff.

You'd basically have something like this:

    <Button>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Image Source="" Grid.Column="0" />
            <TextBlock Grid.Column="1">Your button text</TextBlock>
            <Image Source="" Grid.Column="2"/>
        </Grid>
    </Button>
0

精彩评论

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