2009-08-20 7 views
1

Surface 용 소프트웨어에서 작업하는 동안 약간의 문제가 있습니다. 바인드 된 ScatterView가 있고 항목에 DataTemplate이 있습니다. 내 질문은 : 어떻게 ItemTemplate에서 만든 ScatterViewItem의 너비와 높이를 설정합니까?s : ScatterView ItemTemplate - 높이 또는 너비 설정 방법은 무엇입니까?

 <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> 

답변

3

나는 다른 ItemsControls와 마찬가지로 ItemContainerStyle을 통해 그 설정할 수 있습니다 생각하지만 내가 표면 SDK를 가지고 있지 않는 한 나는 확실하지 않다.

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

물론 고정 단위 대신 바인딩을 사용할 수도 있습니다.

+0

고맙습니다. 작동합니다! –

관련 문제