首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ListBox项目windows电话8

ListBox项目windows电话8
EN

Stack Overflow用户
提问于 2014-07-07 18:48:30
回答 2查看 349关注 0票数 0

如何从ListBox中从C#中调整项的大小?我可以做ListBox.Height = 100;,但是我不知道如何在ListBox中调整条目的大小。帮帮我求你了。

我需要使用listBox方法更改ManipulationDelta中项目的大小及其编号。

主要xaml代码:

代码语言:javascript
复制
<ListBox x:Name="tileList"
        Grid.Row="0"
        Margin="5"
        ManipulationCompleted="tileList_ManipulationCompleted"
        ManipulationDelta="tileList_ManipulationDelta">

    <ListBox.RenderTransform>
        <CompositeTransform/>
    </ListBox.RenderTransform>
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <toolkit:WrapPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <toolkit:HubTile x:Name="hubMain"
                            Title="{Binding Title}"
                            Margin="3"
                            DisplayNotification="{Binding DisplayNotification}"
                            GroupTag="{Binding GroupTag}"
                            Message="{Binding Message}"
                            Notification="{Binding Notification}"
                            Size="Medium"
                            Source="{Binding ImageUri}" />
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

and C# code:

private void tileList_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
    if (e.PinchManipulation != null)
    {

        double newWidth = 0.0, newHieght = 0.0;

        foreach (tileList lv in tileList.Items)
        {
            lv.Height = 10;
        }
    }
}

private void tileList_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
{
    m_Zoom = 200 / 10;
}

Thanks.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-07-07 18:56:24

始终可以在Xaml页面中更改ListBox的ListBox。

代码语言:javascript
复制
<ListBox>
   <ListBox.ItemTemplate>
      <DataTemplate>
         <TextBlock Height="200" Width="200" /> //This is just an example you can use any control
      </DataTemplate>
   </ListBox.ItemTemplate>
</ListBox>

希望这是你想要的。

票数 0
EN

Stack Overflow用户

发布于 2014-07-07 18:52:28

您需要访问列表框中的项并为它们设置个人高度,

代码语言:javascript
复制
 foreach (ListBoxItem lv in YourListbox.Items)
        {
            lv.Height = 10;
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24617692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档