开发者

Problem with align button in treeview in wpf

开发者 https://www.devze.com 2022-12-27 17:49 出处:网络
I\'ve got something: <HierarchicalDataTemplate DataType=\"{x:Type MyService:Country}\" ItemsSource=\"{Binding Path=ListOfAreas}\">

I've got something:

<HierarchicalDataTemplate DataType="{x:Type MyService:Country}"
                                  ItemsSource="{Binding Path=ListOfAreas}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock TextAlignment="Center" Text="{Binding Path=Name}"/>
                    <Button Name="MyButton" Height="20" Content="Add Area"></Butto开发者_如何学运维n>
                </StackPanel>
            </HierarchicalDataTemplate>

It works, but not nice way, because I want to have TextBox at middle hight of button. Now it is at top hight of button.

for example:

NOW:

MYTEXTBOX ||||||||||||
          ||Add Area|| 
          ||||||||||||

Expected result

          ||||||||||||
MYTEXTBOX ||Add Area|| 
          ||||||||||||


You want to set VerticalAlignment to Center (instead of TextAlignment) like this:

<TextBlock VerticalAlignment="Center" ... />
0

精彩评论

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