2011-12-04 7 views
18

मैं माफी अगर सवाल शीर्षक एकदम चमक स्पष्ट हूँ, लेकिन मैं कुछ इस तरह बनाने के लिए कोशिश कर रहा हूँ, मुझे पता नहीं है अगर वे टाइल या छवियों को एक WrapControl अंदर हैं:मैं ऐसा कुछ कैसे कर सकता हूं? (ऐप्लिकेशन के अंदर टाइलें) विंडोज फोन

enter image description here enter image description here

मैं ऐसी चीज को एक रैप पैनल और स्टैपपनेल के रूप में उन सभी ब्लॉकों के साथ बनाने की सोच रहा था। लेकिन मुझे यकीन नहीं है कि क्या यह सही दृष्टिकोण है।

ऐसी चीज करने का कोई नियंत्रण है?

उत्तर

44

आप सही रास्ते पर हैं। WrapPanel जाने का रास्ता है :)

प्रत्येक ब्लॉक को और अधिक रोचक बनाने के लिए, आप नवीनतम windows phone toolkit से HubTile नियंत्रण पर एक नज़र डाल सकते हैं। आप जो भी नियंत्रण/पैनल उपयोग कर रहे हैं, बस याद रखें कि आकार 173 * 173 होना चाहिए।

उपयोग एक ListBox

अपनी परियोजनाओं में से एक में मैं एक ListBox कि यह सब करता है बनाया। ListBox का उपयोग करने का कारण यह है कि ListBox में SelectedItem प्रोपरी है जो मुझे बताती है कि उपयोगकर्ता द्वारा कौन सा टाइल टैप किया गया है। इसके अलावा एक अन्य कारण ListBoxItems अच्छा झुकाव प्रभाव प्राप्त कर सकता है।

Baiscally तुम सिर्फ एक टाइल की तरह ListBoxItem शैली बना सकते हैं और करने के लिए ListBox रों ItemsPanel एक WrapPanel होने के लिए की ItemContainerStyle, यह भी आप स्थापित करने के लिए ListBox जरूरत है 'इसे लागू करने की जरूरत है।

यह कैसे लग रहा है

enter image description here

ListBoxItem शैली

<Style x:Key="TileListBoxItemStyle" TargetType="ListBoxItem"> 
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/> 
    <Setter Property="VerticalContentAlignment" Value="Stretch"/> 
    <Setter Property="Padding" Value="0"/> 
    <Setter Property="FontSize" Value="64"/> 
    <Setter Property="Margin" Value="12,12,0,0"/> 
    <Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/> 
    <Setter Property="Foreground" Value="White"/> 
    <Setter Property="Width" Value="173"/> 
    <Setter Property="Height" Value="173"/> 
    <Setter Property="HorizontalAlignment" Value="Left"/> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="ListBoxItem"> 
       <Grid> 
        <Rectangle Fill="{TemplateBinding Background}"/> 
        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
       </Grid> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 

ListBox

 <!-- set its ItemContainerStyle which is the style for each ListBoxItem --> 
     <ListBox ItemContainerStyle="{StaticResource TileListBoxItemStyle}"> 
      <!-- set its ItemsPanel to be a WrapPanel --> 
       <ListBox.ItemsPanel> 
       <ItemsPanelTemplate> 
        <toolkit:WrapPanel /> 
       </ItemsPanelTemplate> 
      </ListBox.ItemsPanel> 
      <ListBoxItem> 
       <Grid> 
        <TextBlock Text="Messages" /> 
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> 
         <Path Data="M1.4901163E-05,9.8579922 L50.000015,46.316994 L100.00002,9.8579922 L100.00002,62.499992 L1.4901163E-05,62.499992 z M0,0 L100,0 L50,36.458 z" Fill="White" Height="38.125" Stretch="Fill" UseLayoutRounding="False" Width="61" d:IsLocked="True" /> 
         <TextBlock Text="12" Margin="4,0,0,8" /> 
        </StackPanel> 
       </Grid> 
      </ListBoxItem> 
      <ListBoxItem/> 
      <ListBoxItem/> 
      <ListBoxItem/> 
      <toolkit:HubTile Title="Me ☺" Message="..." Notification="new messages!" Source="xxx.jpg" Margin="12,12,0,0" /> 
     </ListBox> 

आप देख सकते हैं कि अंतिम आइटम वास्तव में HubTile है।

आशा है कि मदद करता है! :)

+1

धन्यवाद !!! वास्तव में मैं क्या चाहता हूं: डी – Ateik

+0

खुशी हुई इससे मदद मिली। :) –

+0

@Xin क्या आप कृपया मुझे एक लिंक या कुछ उदाहरण सुझा सकते हैं ... मैं एक सीखने की अवस्था में हूं ... और मैं उपरोक्त चीज़ को अपने आवेदन में करना चाहता हूं .. –

संबंधित मुद्दे