Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 散射视图项目模板-如何设置高度或宽度?_Wpf_Pixelsense_Itemtemplate_Scatterview - Fatal编程技术网

Wpf 散射视图项目模板-如何设置高度或宽度?

Wpf 散射视图项目模板-如何设置高度或宽度?,wpf,pixelsense,itemtemplate,scatterview,Wpf,Pixelsense,Itemtemplate,Scatterview,在为曲面开发软件时,我遇到了一个小问题:我有一个绑定的ScatterView,它的项有一个DataTemplate。我的问题是:如何设置从ItemTemplate创建的ScatterViewItem的宽度和高度 <s:ScatterView Name="svMain" Loaded="svMain_Loaded" ItemsSource="{Binding BallsCollection}" > <s:ScatterView.ItemTemplate

在为曲面开发软件时,我遇到了一个小问题:我有一个绑定的ScatterView,它的项有一个DataTemplate。我的问题是:如何设置从ItemTemplate创建的ScatterViewItem的宽度和高度

      <s:ScatterView Name="svMain" Loaded="svMain_Loaded" ItemsSource="{Binding BallsCollection}" >
        <s:ScatterView.ItemTemplate >
            <DataTemplate>
                <DockPanel LastChildFill="True" >
                    <DockPanel.Background>
                        <ImageBrush ImageSource="image\note.png" Stretch="Fill" />
                    </DockPanel.Background>
                    <TextBox Background="Transparent" DockPanel.Dock="Top" Text="{Binding Path=Message}"
                             IsReadOnly="True" TextWrapping="Wrap"></TextBox>
                </DockPanel>
            </DataTemplate>
        </s:ScatterView.ItemTemplate>
    </s:ScatterView>

我相信您可以通过ItemContainerStyle进行设置,就像其他ItemsControl一样,但我不确定,因为我没有Surface SDK

    <s:ScatterView.ItemContainerStyle>
        <Style TargetType="{x:Type s:ScatterViewItem}">
            <Setter Property="Width" Value="100"/>
            <Setter Property="Height" Value="100"/>
        </Style>            
    </s:ScatterView.ItemContainerStyle>

当然,也可以使用绑定而不是固定单位