• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Move button by TextBlock length

Hello all,

I program with WPF. How can I move my button according to the length of TextBlock? The button should always at the end of the Textblock. (Attached file, button doesn't move together with the TextBlock)  

myFile.xaml

<UserControl>
     <Grid>
          <DataGrid>
               <DataGrid.Columns>
                     <DataGridTextColumn ....  />
                     <DataGridTextColumn ....  />
                      <DataGridTemplateColumn>
                      <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock HorizontalAlignment="Left"/>
                                <Button HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
               </DataGrid.Columns>
          </DataGrid>
     </Grid>
</UserControl>

Thank you very much in advance. :)
2011-10-25-124014.jpg
0
chang2008
Asked:
chang2008
1 Solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now