UWP AdaptiveGrivew horizontalAligment not working
I creat app UWP and using AdaptiveGridView of Mircosoft.Toolkit but when i create my ToggleButton in AdaptiveGridView not in center. How i can fix it?
My Code
<Page.Resources>
<DataTemplate x:Key="ToggleButtonTemplate">
<Grid>
<ToggleButton x:Name="a" Content="Binding Textttt"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinWidth="150" Click="Button_Click"
Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
</DataTemplate>
<Page.Resources>
<controls:AdaptiveGridView Name="MenuItemGrid"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="5"
ItemTemplate="StaticResource ToggleButtonTemplate"
Grid.Row="0"/>
.net xaml uwp
add a comment |
I creat app UWP and using AdaptiveGridView of Mircosoft.Toolkit but when i create my ToggleButton in AdaptiveGridView not in center. How i can fix it?
My Code
<Page.Resources>
<DataTemplate x:Key="ToggleButtonTemplate">
<Grid>
<ToggleButton x:Name="a" Content="Binding Textttt"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinWidth="150" Click="Button_Click"
Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
</DataTemplate>
<Page.Resources>
<controls:AdaptiveGridView Name="MenuItemGrid"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="5"
ItemTemplate="StaticResource ToggleButtonTemplate"
Grid.Row="0"/>
.net xaml uwp
add a comment |
I creat app UWP and using AdaptiveGridView of Mircosoft.Toolkit but when i create my ToggleButton in AdaptiveGridView not in center. How i can fix it?
My Code
<Page.Resources>
<DataTemplate x:Key="ToggleButtonTemplate">
<Grid>
<ToggleButton x:Name="a" Content="Binding Textttt"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinWidth="150" Click="Button_Click"
Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
</DataTemplate>
<Page.Resources>
<controls:AdaptiveGridView Name="MenuItemGrid"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="5"
ItemTemplate="StaticResource ToggleButtonTemplate"
Grid.Row="0"/>
.net xaml uwp
I creat app UWP and using AdaptiveGridView of Mircosoft.Toolkit but when i create my ToggleButton in AdaptiveGridView not in center. How i can fix it?
My Code
<Page.Resources>
<DataTemplate x:Key="ToggleButtonTemplate">
<Grid>
<ToggleButton x:Name="a" Content="Binding Textttt"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinWidth="150" Click="Button_Click"
Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
</DataTemplate>
<Page.Resources>
<controls:AdaptiveGridView Name="MenuItemGrid"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="5"
ItemTemplate="StaticResource ToggleButtonTemplate"
Grid.Row="0"/>
.net xaml uwp
.net xaml uwp
edited Nov 20 '18 at 8:10
Nico Zhu - MSFT
9,5881421
9,5881421
asked Nov 14 '18 at 7:07
Mr DMr D
53
53
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try to use Row and Column definitions and then set Grid.Column="0" and Grid.Row="0" for ToggleButton like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/><RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/><ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="a" Grid.Row="0" Grid.Column="0" Content="Binding Textttt"
HorizontalAlignment="Center" VerticalAlignment="Center"
MinWidth="150" Click="Button_Click" Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
I hope this help you.
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
|
show 3 more comments
This works as expected. At first I thought what is wrong at all looking at the picture. At the end I realize that you want the last two items to be centered in the last row instead of displaying them from the start.
In theory it is possible, but there is no operating system in existence with controls that would work like that as far as I know (and I've built applications for all major operating systems). So you have to build everything from the scratch if you really want that, you can't rely on any control as simply this isn't considered as a good design.
Horizontal alignment means of how your control is placed inside its container, not how the container is placed inside its row, there is no property that would affect that.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294775%2fuwp-adaptivegrivew-horizontalaligment-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to use Row and Column definitions and then set Grid.Column="0" and Grid.Row="0" for ToggleButton like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/><RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/><ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="a" Grid.Row="0" Grid.Column="0" Content="Binding Textttt"
HorizontalAlignment="Center" VerticalAlignment="Center"
MinWidth="150" Click="Button_Click" Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
I hope this help you.
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
|
show 3 more comments
Try to use Row and Column definitions and then set Grid.Column="0" and Grid.Row="0" for ToggleButton like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/><RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/><ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="a" Grid.Row="0" Grid.Column="0" Content="Binding Textttt"
HorizontalAlignment="Center" VerticalAlignment="Center"
MinWidth="150" Click="Button_Click" Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
I hope this help you.
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
|
show 3 more comments
Try to use Row and Column definitions and then set Grid.Column="0" and Grid.Row="0" for ToggleButton like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/><RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/><ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="a" Grid.Row="0" Grid.Column="0" Content="Binding Textttt"
HorizontalAlignment="Center" VerticalAlignment="Center"
MinWidth="150" Click="Button_Click" Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
I hope this help you.
Try to use Row and Column definitions and then set Grid.Column="0" and Grid.Row="0" for ToggleButton like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/><RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/><ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="a" Grid.Row="0" Grid.Column="0" Content="Binding Textttt"
HorizontalAlignment="Center" VerticalAlignment="Center"
MinWidth="150" Click="Button_Click" Style="StaticResource HeinekenToggleButtonStyle"
/>
</Grid>
I hope this help you.
answered Nov 14 '18 at 9:13
MKHMKH
232310
232310
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
|
show 3 more comments
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
It's not working. I just want item in adaptiveGridvew horizontal center. But horizontal not working, i don't understand.
– Mr D
Nov 14 '18 at 9:33
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
I think ToggleButtons are centered in its parent Grid But for AdaptiveGridView , Which version of toolkit is installed? refer to this old fix for this problem AdaptiveGridView HorizontalAlignment not working after version 2.0.0 Also did you tested it by replacing AdaptiveGridView with standard GridView ?
– MKH
Nov 14 '18 at 9:55
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
i use version 5.0.0. I have read your link but i don't understand and i don't see how to fix it
– Mr D
Nov 14 '18 at 10:04
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
I have a try with GridView but it does not work either
– Mr D
Nov 14 '18 at 10:10
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
If you are using ver5.0 no problem , Its an old thread and fixed already.
– MKH
Nov 14 '18 at 10:12
|
show 3 more comments
This works as expected. At first I thought what is wrong at all looking at the picture. At the end I realize that you want the last two items to be centered in the last row instead of displaying them from the start.
In theory it is possible, but there is no operating system in existence with controls that would work like that as far as I know (and I've built applications for all major operating systems). So you have to build everything from the scratch if you really want that, you can't rely on any control as simply this isn't considered as a good design.
Horizontal alignment means of how your control is placed inside its container, not how the container is placed inside its row, there is no property that would affect that.
add a comment |
This works as expected. At first I thought what is wrong at all looking at the picture. At the end I realize that you want the last two items to be centered in the last row instead of displaying them from the start.
In theory it is possible, but there is no operating system in existence with controls that would work like that as far as I know (and I've built applications for all major operating systems). So you have to build everything from the scratch if you really want that, you can't rely on any control as simply this isn't considered as a good design.
Horizontal alignment means of how your control is placed inside its container, not how the container is placed inside its row, there is no property that would affect that.
add a comment |
This works as expected. At first I thought what is wrong at all looking at the picture. At the end I realize that you want the last two items to be centered in the last row instead of displaying them from the start.
In theory it is possible, but there is no operating system in existence with controls that would work like that as far as I know (and I've built applications for all major operating systems). So you have to build everything from the scratch if you really want that, you can't rely on any control as simply this isn't considered as a good design.
Horizontal alignment means of how your control is placed inside its container, not how the container is placed inside its row, there is no property that would affect that.
This works as expected. At first I thought what is wrong at all looking at the picture. At the end I realize that you want the last two items to be centered in the last row instead of displaying them from the start.
In theory it is possible, but there is no operating system in existence with controls that would work like that as far as I know (and I've built applications for all major operating systems). So you have to build everything from the scratch if you really want that, you can't rely on any control as simply this isn't considered as a good design.
Horizontal alignment means of how your control is placed inside its container, not how the container is placed inside its row, there is no property that would affect that.
answered Nov 20 '18 at 10:32
Ivan IčinIvan Ičin
3,87342343
3,87342343
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294775%2fuwp-adaptivegrivew-horizontalaligment-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown