User control or user control for this design?

alt text

If I want to create such a button control, should it be a custom control or a custom control? I'm not sure, maybe something else? Ideally, I want to be able to style / animate the main button and the inner button separately; It is also obvious that I need to handle my events separately. These buttons will be created at runtime and I will need to dynamically set icons.

+2


a source to share


1 answer


I would suggest a custom control. You can still create your base styling in xaml and use the code for dynamic stuff.

You 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>

      

+2


a source







All Articles