zoukankan      html  css  js  c++  java
  • 十八、平铺+将ListBoxitem的宽度设定为ListBox的三分之一

    Silverlight 怎么把图片平铺?

    1<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Horizontal">
               
            </StackPanel>


     2           <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controlsToolkit:WrapPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>

    如何将ListBoxitem的宽度设定为ListBox的三分之一? 我已经写了一个Converter,可是在XAML中如何写呢 总也运行不对,请教各位大大

    里面加一个Grid 然后按比例 分为三列 让Item在 Grid.Row =2;

    <ListBox> <ListBox.ItemTemplate> <DataTemplate> .....</DataTemplate> </ListBox.ItemTemplate>            <ListBox.ItemsPanel>                 <ItemsPanelTemplate>                     <controlsToolkit:WrapPanel Orientation="Horizontal"/>                 </ItemsPanelTemplate>             </ListBox.ItemsPanel>             <ListBox.ItemContainerStyle>                 <Style TargetType="ListBoxItem">                     <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListBox, AncestorLevel=1}, Path=Width, Converter={StaticResource WidthConverter}, ConverterParameter=4}"/>                 </Style>             </ListBox.ItemContainerStyle>             <!--<i:Interaction.Behaviors>                 <Behaviors:SynchronizeSelectedItems Selections="{Binding SelectedOption}"/>             </i:Interaction.Behaviors>-->

            </ListBox>

    不能使用固定列数,因为是需要根据不同的情况,设定为2,3,4列的

    那 你的 1/3如何取呢 :给Converter传一个参数

  • 相关阅读:
    VMware Workstation9安装Mac OS X10.9系统
    如何在windows下的Python开发工具IDLE里安装其他模块?
    Git在下搭建下环境的工具
    Git的安装与使用
    Linux(CentOs6.4)安装Git
    VMware虚拟机上网络连接(network type)的三种模式--bridged、host-only、NAT
    centos 6.5 升级内核 linux 3.12.17
    让CentOS系统时间同步
    编译安装LNMP Centos 6.5 x64 + Nginx1.6.0 + PHP5.5.13 + Mysql5.6.19
    64位CentOS5.6安装Mysql 5.5.11GA
  • 原文地址:https://www.cnblogs.com/suinuaner/p/pingpu.html
Copyright © 2011-2022 走看看