开发者

User control or custom control for this design?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜