6

विंडोज स्टोर ऐप में, मेरे पास XAML में GridView है। मैंने SelectionMode="Extended" सेट किया है और मैं बिना किसी प्रकार की समस्या के आइटम चुन सकता हूं। हालांकि, मैं विंडोज 8.1 के चयन मोड को प्राप्त करना चाहता हूं। विंडोज 8.1 के टच वर्जन में जब आप स्टार्ट स्क्रीन में किसी आइटम पर अपनी अंगुली रखते हैं, तो पूरी स्क्रीन किसी प्रकार के "प्रबंधन मोड" पर जाती है जिसमें किसी आइटम पर टैप करने से उसे स्क्रीन पर कहीं भी टैप करना होगा या आइटम पर तुरंत टैप करना होगा उन सभी को अचयनित कर देगा और कहीं भी टैप करेंगे जब इस मोड से कुछ भी नहीं चुना जाता है। यहाँ है कि मोड की एक तस्वीर है:ग्रिडव्यू में विंडोज 8.1 चयन मोड

Windows 8.1 selection mode

अगर मैं इसे अपने आप को लागू करने की कोशिश मैं कुछ इस तरह प्राप्त कर सकते हैं। हालांकि मुझे आश्चर्य है कि वहां पहले से ही ऐसा कुछ है।

+0

मुझे विश्वास नहीं है कि दुर्भाग्य से यह अंतर्निहित कार्यक्षमता है। आपको एक कस्टम 'ग्रिड व्यू' लागू करना होगा। –

+0

यदि आपने इसे स्वयं लागू किया है, तो वास्तव में एक github लिंक वास्तव में अच्छा होगा। ;) –

+0

@ डनू मैं इसके बारे में सोच रहा हूं। मुझे लगता है कि वर्तमान के बीच कुछ करना और यह कार्यान्वयन पर्याप्त होगा। अंत में, मैं इसके बारे में ब्लॉग करूंगा और इसे तैयार होने पर गीथूब पर रखूंगा। –

उत्तर

1

आप चयनित आइटम पृष्ठभूमि बनाने के लिए कुछ tweaks के साथ सूचीदृश्य के लिए माइक्रोसॉफ्ट द्वारा प्रदान की गई डिफ़ॉल्ट शैलियों का उपयोग कर सकते हैं। अंतरिक्ष सीमा के कारण, मैं तैयार संदर्भ के लिए मूल ListViewItem शैली पर किए गए परिवर्तनों सहित हूं:

<VisualState x:Name="Selecting"> 
<Storyboard> 
    <DoubleAnimation Storyboard.TargetName="SelectionBackground" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="0" /> 
    <DoubleAnimation Storyboard.TargetName="SelectedBorder" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="1" /> 
    <DoubleAnimation Storyboard.TargetName="SelectingGlyph" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="1" /> 
    <DoubleAnimation Storyboard.TargetName="HintGlyphBorder" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="1" /> 
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" 
           Storyboard.TargetProperty="Foreground"> 
     <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListViewItemSelectedForegroundThemeBrush}" /> 
    </ObjectAnimationUsingKeyFrames> 
</Storyboard> 
</VisualState> 
<VisualState x:Name="Selected"> 
<Storyboard> 
    <DoubleAnimation Storyboard.TargetName="SelectionBackground" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="0" /> 
    <DoubleAnimation Storyboard.TargetName="SelectedBorder" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="1" /> 
    <DoubleAnimation Storyboard.TargetName="SelectedCheckMark" 
       Storyboard.TargetProperty="Opacity" 
       Duration="0" 
       To="1" /> 
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" 
           Storyboard.TargetProperty="Foreground"> 
     <DiscreteObjectKeyFrame KeyTime="0" Value="White" /> 
    </ObjectAnimationUsingKeyFrames> 
</Storyboard> 
</VisualState> 

    <Border x:Name="ContentContainer"> 
<Grid x:Name="InnerDragContent"> 
<Rectangle x:Name="PointerOverBorder" 
IsHitTestVisible="False" 
Opacity="0" 
Fill="{ThemeResource ListViewItemPointerOverBackgroundThemeBrush}" 
Margin="1" /> 
<Rectangle x:Name="FocusVisual" 
IsHitTestVisible="False" 
Opacity="0" 
StrokeThickness="2" 
Stroke="{ThemeResource ListViewItemFocusBorderThemeBrush}" /> 
<Rectangle x:Name="SelectionBackground" 
Margin="4" 
Fill="White" 
Opacity="0" /> 
<Border x:Name="ContentBorder" 
Background="White" 
BorderBrush="Blue" 
BorderThickness="{TemplateBinding BorderThickness}" 
Margin="4"> 
<Grid> 
<ContentPresenter x:Name="contentPresenter" 
     ContentTransitions="{TemplateBinding ContentTransitions}" 
     ContentTemplate="{TemplateBinding ContentTemplate}" 
     Content="{TemplateBinding Content}" 
     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
     VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
     Margin="{TemplateBinding Padding}" /> 
<!-- The 'Xg' text simulates the amount of space one line of text will occupy. 
In the DataPlaceholder state, the Content is not loaded yet so we 
approximate the size of the item using placeholder text. --> 
<TextBlock x:Name="PlaceholderTextBlock" 
Opacity="0" 
Text="Xg" 
Foreground="{x:Null}" 
Margin="{TemplateBinding Padding}" 
IsHitTestVisible="False" 
AutomationProperties.AccessibilityView="Raw"/> 
<Rectangle x:Name="PlaceholderRect" 
Visibility="Collapsed" 
Fill="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"/> 
<Rectangle x:Name="MultiArrangeOverlayBackground" 
IsHitTestVisible="False" 
Opacity="0" 
Fill="{ThemeResource ListViewItemDragBackgroundThemeBrush}" /> 
</Grid> 
</Border> 
<Rectangle x:Name="SelectedBorder" 
IsHitTestVisible="False" 
Opacity="0" 
Stroke="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" 
StrokeThickness="{ThemeResource ListViewItemSelectedBorderThemeThickness}" 
Margin="4" /> 
<Border x:Name="SelectedCheckMarkOuter" 
IsHitTestVisible="False" 
HorizontalAlignment="Right" 
VerticalAlignment="Top" 
Margin="4"> 
<Grid x:Name="SelectedCheckMark" Opacity="0" Height="40" Width="40"> 
<Path x:Name="SelectedEarmark" Data="M0,0 L40,0 L40,40 z" Fill="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" Stretch="Fill"/> 
<Path Data="F1 M133.1,17.9 L137.2,13.2 L144.6,19.6 L156.4,5.8 L161.2,9.9 L145.6,28.4 z" Fill="{ThemeResource ListViewItemCheckThemeBrush}" Height="13" Stretch="Fill" Width="15" HorizontalAlignment="Right" Margin="0,5.5,5.5,0" VerticalAlignment="Top" FlowDirection="LeftToRight"/> 
</Grid> 
</Border> 
<TextBlock x:Name="MultiArrangeOverlayText" 
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DragItemsCount}" 
Foreground="{ThemeResource ListViewItemDragForegroundThemeBrush}" 
FontFamily="{ThemeResource ContentControlThemeFontFamily}" 
FontSize="26.667" 
IsHitTestVisible="False" 
Opacity="0" 
TextWrapping="Wrap" 
TextTrimming="WordEllipsis" 
Margin="18,9,0,0" 
AutomationProperties.AccessibilityView="Raw"/> 
</Grid> 
</Border> 
+0

धन्यवाद। मैंने इसका परीक्षण नहीं किया है लेकिन ASAP होगा। अभी के लिए मैं इसे जवाब के रूप में चुनता हूं। –

0

आप अपने जैसे कुछ हासिल कर सकते हैं, मुझे पता है क्योंकि मुझे इसे एक ऐप के लिए करना था जिसे मैं क्लाइंट के लिए लिख रहा था।

मेरे पास क्या काम है, लेकिन यह बहुत ही सुरुचिपूर्ण नहीं है। शायद मैं इसे गिटहब पर रख सकता हूं और फिर अन्य किसी न किसी किनारों को ठीक कर सकते हैं और इसे और अधिक सुरुचिपूर्ण बना सकते हैं।

यदि आप इसके लिए इंतजार नहीं कर सकते हैं तो मैं कम से कम आपको सही दिशा में इंगित कर सकता हूं। http://www.codeproject.com/Articles/536519/Extending-GridView-with-Drag-and-Drop-for-Grouping

खींचें हो और समूहों के भीतर काम कर रहे हैं और नए समूह बनाने ड्रॉप करने के लिए एक अच्छी शुरुआत है कि: के साथ

प्रारंभ।

आपको समूह और वस्तुओं के साथ-साथ शीर्षलेख शैलियों दोनों के लिए कंटेनर स्टाइल के कुछ अनुकूलन करने की आवश्यकता होगी।

मेरे पास कार्यान्वयन को फिर से उपयोग करने के लिए लिखा नहीं गया है, इसलिए यह मेरे ऐप के साथ कुछ हद तक जोड़ा गया है। इसे डिसकप्लिंग करना और इसे उस नियंत्रण में डालना जिसे दूसरों द्वारा पुन: उपयोग किया जा सकता है, इसमें कुछ समय लगेगा।

यदि आप इसके साथ संघर्ष कर रहे हैं तो अधिक समय हो सकता है यदि मैं आपको शैलियों और कुछ कोड के लिए कुछ कोड स्निपेट भेजता हूं।

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