0

I have a UWP app. There, I have one CommandBar which has some AppBarButton. Now, I need to add some customized radio button in the same command bar and these radio buttons will be grouped together and shown exactly in the middle of the command bar (not right aligned like it does as the default behavior).

Is there a way to achieve it using the CommandBar?

tavier
  • 1,744
  • 4
  • 24
  • 53

1 Answers1

3

Yes, you can. Look at the official sample. In sample you can find a lot of combinations how use app bar in your UWP Application

UPDATE:

<Page.BottomAppBar>
    <CommandBar>
        <CommandBar.Content>
            <Grid> 
                <RadioButton />
             ...  

p.s. don't forget for HorizontalAlignment and HorizontalContentAlignment property

Andrii Krupka
  • 4,276
  • 3
  • 20
  • 41
  • Hi, I looked at the sample but could not find a way to add any other controls (than AppBarButton) to the CommandBar. My requirement is to add some radio buttons inside the CommandBar. Also, I need to align those radio buttons in the center (not to right side as it does with the AppBarButton). – tavier Jul 12 '16 at 07:43
  • I updated an answer. so, in UWP app you can use Content property in your CommandBar – Andrii Krupka Jul 12 '16 at 07:57
  • Thanks, it works except the alignment part. I tried setting the HorizontalAlignment og the Grid as Center and HorizontalContentAlignment for the Button as Center but it was showing up on the extreme left of the Command Bar. – tavier Jul 12 '16 at 09:20
  • That is it. Setting HorizontalContentAlignment for the CommandBar does the trick. Thanks :) – tavier Jul 12 '16 at 09:39