2013-04-12 9 views
5

में एक्सपेंडर का आकार बदलने की अनुमति दें मेरे पास बहुत सारे सी # और WinForms अनुभव हैं लेकिन WPF के लिए नौसिखिया हैं। मेरे पास एक एक्सपेंडर वाला विंडो है जो नीचे की तरफ फैला हुआ है। प्रश्न बॉक्स की तरह मैं वर्तमान में टाइप कर रहा हूं, मैं चाहता हूं कि उपयोगकर्ता नीचे दिए गए ग्लिफ (इस प्रश्न बॉक्स की तरह) पर क्लिक करके एक्सपेंडर को गतिशील रूप से आकार देने में सक्षम हों और विस्तारक को वांछित आकार में खींचें।उपयोगकर्ताओं को डब्ल्यूपीएफ

क्या कोई भी ऐसा करने के लिए एक्सएएमएल (और कोई अतिरिक्त कोड) प्रदान कर सकता है?

<Expander Header="Live Simulations" Name="expandLiveSims" Grid.Row="0" ExpandDirection="Down" IsExpanded="True"> 
    <Expander.Background> 
     <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> 
      <GradientStop Color="White" Offset="0" /> 
      <GradientStop Color="LightGray" Offset="0.767" /> 
      <GradientStop Color="Gainsboro" Offset="1" /> 
     </LinearGradientBrush> 
    </Expander.Background> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="*" /> 
      <RowDefinition Height="Auto" /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="Auto" /> 
      <ColumnDefinition Width="Auto" /> 
     </Grid.ColumnDefinitions> 
     <DataGrid Height="250" Margin="5" Name="gridLiveProducts" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0"> 
     </DataGrid> 
     <GridSplitter Grid.Row="0" Grid.Column="1" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"> 
      <GridSplitter.Background> 
       <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> 
        <GradientStop Color="White" Offset="0" /> 
        <GradientStop Color="DarkGray" Offset="0.25" /> 
        <GradientStop Color="DarkGray" Offset="0.75" /> 
        <GradientStop Color="Gainsboro" Offset="1" /> <!-- Gainsboro matches the expander --> 
       </LinearGradientBrush> 
      </GridSplitter.Background> 
     </GridSplitter> 
     <Border Grid.Row="0" Grid.Column="2" Background="White" BorderBrush="Black" BorderThickness="1" Margin="5" > 
      <Image Height="250" HorizontalAlignment="Right" Name="imgShares" Stretch="Fill" VerticalAlignment="Top" Width="250"> 
      </Image> 
     </Border> 
     <GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3"> 
      <GridSplitter.Background> 
       <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> 
        <GradientStop Color="Gainsboro" Offset="0" /> 
        <GradientStop Color="DarkGray" Offset="0.25" /> 
        <GradientStop Color="DarkGray" Offset="0.75" /> 
        <GradientStop Color="Gainsboro" Offset="1" /> 
       </LinearGradientBrush> 
      </GridSplitter.Background> 
     </GridSplitter> 
    </Grid> 
</Expander> 
+0

आप एक समाधान मिला? – OsakaHQ

+0

कोई वास्तविक समाधान नहीं मिला था। हमने यूआई को दोबारा प्रतिक्रिया दी और यह अब आवश्यक नहीं था। –

उत्तर

6

आप GridSplitter साथ Grid उपयोग करने के लिए:

यह वही है मैं अब तक है।

इस तरह

:

ऊंचाई
<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*"/> 
     <RowDefinition Height="auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 
    <Expander Grid.Row="0" Background="Azure"></Expander> <!--this is you Expander--> 
    <GridSplitter Grid.Row="1" Height="10" Background="Red" ResizeDirection="Rows" HorizontalAlignment="Stretch"/> <!--this GridSplitter represents the glyph--> 
</Grid> 
इस तरह से सफलता के लिए

, टो बांधना पक्षों होना चाहिए = "*"

+2

मैंने कोशिश की और यह विस्तारक के आकार बदलने की अनुमति देता है, लेकिन एक्सपेंडर अब विस्तार/पतन आइकन का जवाब नहीं देता है। मैं विस्तारक को सामान्य की तरह पतन करना चाहता हूं, लेकिन विस्तारित आकार के उपयोगकर्ता नियंत्रण की अनुमति देता हूं। –

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