Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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 调整窗口大小时,如何调整容器中的子GridControl的大小?_Wpf_C# 4.0_Devexpress Windows Ui - Fatal编程技术网

Wpf 调整窗口大小时,如何调整容器中的子GridControl的大小?

Wpf 调整窗口大小时,如何调整容器中的子GridControl的大小?,wpf,c#-4.0,devexpress-windows-ui,Wpf,C# 4.0,Devexpress Windows Ui,我的应用程序有一个容器视图,它是dockpanel。此容器视图包含4个UserControl,它们再次使用dockpanel实现。我想在调整窗口大小时调整usercontrol的大小 我的容器视图: <StackPanel > <StackPanel.Background> <ImageBrush ImageSource="/JIRA;component/Images/back.jpg"/> </StackPanel.B

我的应用程序有一个容器视图,它是dockpanel。此容器视图包含4个UserControl,它们再次使用dockpanel实现。我想在调整窗口大小时调整usercontrol的大小

我的容器视图:

 <StackPanel >
    <StackPanel.Background>
        <ImageBrush ImageSource="/JIRA;component/Images/back.jpg"/>
    </StackPanel.Background>
    <View:IssueView   Height="413" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

    <View:WorkLogView  Height="413" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

</StackPanel>

发布视图:

<DockPanel>
    <dxg:GridControl 
        x:Name="IssueWindow"
            AutoGenerateColumns="None" 
            HorizontalAlignment="Left" 
            Width="Auto"
            Height="auto"
            VerticalAlignment="Stretch"
            ItemsSource="{Binding Path= jiraIssues}"
            SelectedItem="{Binding Path=SelectedIssue, Mode=TwoWay}"
            DockPanel.Dock="Left" 
           >



    <dxg:GridControl.Columns>
            <dxg:GridColumn AllowColumnFiltering="False" FieldName="Key" AllowEditing="False" AllowResizing="True"/>
            <dxg:GridColumn AllowColumnFiltering="False" FieldName="Summary"  AllowEditing="False" AllowResizing="True"/>
            <dxg:GridColumn FieldName="Reporter" AllowEditing="False" AllowResizing="True"/>
            <dxg:GridColumn FieldName="Assignee" AllowEditing="False" AllowResizing="True"/>
            <dxg:GridColumn AllowColumnFiltering="False" FieldName="Status.Name" AllowEditing="False" AllowResizing="True"/>
            <dxg:GridColumn AllowColumnFiltering="False" FieldName="Created" AllowEditing="False" AllowResizing="True"/>
            <!--<dxg:GridColumn FieldName="Request Date" AllowEditing="False" AllowResizing="True"/>-->
        </dxg:GridControl.Columns>

        <dxg:GridControl.View>

            <dxg:TableView ShowTotalSummary="True" 
                           ShowGroupPanel="False" 
                           AllowCascadeUpdate="True"
                           AllowBestFit="True"
                           BestFitArea="All"
                           AllowResizing="False"
                           MaxWidth="750"
                           MinWidth="750"
                           AllowScrollAnimation="True"/>
        </dxg:GridControl.View>
    </dxg:GridControl>


    <Border BorderBrush="#FF85A0C7"
            BorderThickness="3" 
            CornerRadius="6"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            MinWidth="300"
            DockPanel.Dock="Right"
            >
        <dxl:FlowLayoutControl 
        ItemTemplate="{StaticResource borderdataTemplate}"
        DockPanel.Dock="Left" 
        Orientation="Vertical" 
        Margin="0,-1,0,1"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            Background="#FFDBE6EE"
            >

            <GroupBox 
                Header="Details" 
               HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
              HorizontalContentAlignment="Left"

                x:Name="Details"
                BorderThickness="2" Width="298" 
                Height="156"
                >
                <StackPanel Width="200">
                    <dxl:LayoutItem 
                    Label="Type :"
                    Width="100"
                    HorizontalAlignment="Left" Margin="-43,5,0,0">

                        <Label


                    Content="{Binding Path=Type}"
                     x:Name="TimeSpent" 
                     HorizontalAlignment="Left" 

                         />

                    </dxl:LayoutItem>


                    <dxl:LayoutItem 
                    Label="Status :" 

                    HorizontalAlignment="Left" Margin="-43,03,0,0">
                        <Label

                    Width="100"
                   Content="{Binding Path=Status}"

                     HorizontalAlignment="Left" 

                         />


                    </dxl:LayoutItem>

                    <dxl:LayoutItem 
                    Label="Assignee :"
                    HorizontalAlignment="Stretch" Margin="-43,03,43,0">

                        <Label


                   Content="{Binding Path=Assignee}"

                     HorizontalAlignment="Stretch" 

                         />

                    </dxl:LayoutItem>


                    <dxl:LayoutItem 
                    Label="Reporter :" 

                    HorizontalAlignment="Stretch" Margin="-43,03,43,0">
                        <Label

                   Content="{Binding Path=Reporter}"
                     HorizontalAlignment="Stretch" 

                         />
                    </dxl:LayoutItem>
                    <dxl:LayoutItem 
                    Label="Requested Date :" 

                    HorizontalAlignment="Stretch" Margin="-43,03,43,0">
                        <Label

                   Content="{Binding Path=RequestDate}"
                     HorizontalAlignment="Stretch" 

                         />
                    </dxl:LayoutItem>

                    <dxl:LayoutItem Label="Created :" 
                                    HorizontalAlignment="Stretch" 
                                    Margin="-43,03,43,0"
                                    >
                        <Label HorizontalAlignment="Stretch"

                               Content="{Binding Path=Created}" 
                               x:Name="Created"></Label>
                    </dxl:LayoutItem>

                    <dxl:LayoutItem Label="Updated :" 
                                    HorizontalAlignment="Stretch" 
                                    VerticalAlignment="Stretch" 
                                    Margin="-43,03,42,0">

                        <Label HorizontalAlignment="Left" 

                               x:Name="Updated"
                               Content="{Binding Path=Updated}"></Label>
                    </dxl:LayoutItem>

                    <dxl:LayoutItem 
                    Label="Department :" 
                    HorizontalAlignment="Left" Margin="-43,03,0,0"
                        >
                        <Label


                   Content="{Binding Path=Department}"

                     HorizontalAlignment="Left" 
                         Margin="0,0,0,0"
                         />
                    </dxl:LayoutItem>


                </StackPanel>
            </GroupBox>

            <GroupBox Header="Description" Margin="0,28,0,0" Height="150" Width="300" >
                <ScrollViewer BorderBrush="#FFDBE6EE">
                <TextBlock x:Name="Description"
                       Width="250"
                       HorizontalAlignment="Stretch"
                           VerticalAlignment="Stretch"
                       Text="{Binding Path=Description}"
                        TextWrapping="WrapWithOverflow"
                           TextOptions.TextRenderingMode="Auto"

                           TextAlignment="Left" Height="125"
                           ></TextBlock>
                </ScrollViewer>
            </GroupBox>



        </dxl:FlowLayoutControl>
    </Border>
</DockPanel>

工作日志视图:

 <DockPanel Margin="0,0,0,0">
    <dxg:GridControl 
            DockPanel.Dock="Left"
            AutoGenerateColumns="None" 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Stretch"
            ItemsSource="{Binding Path= WorkLogData}"
        x:Name="workLogDataView"
        FocusManager.FocusedElement="{Binding Path= SelectedWorkLog}"
            SelectedItem="{Binding Path = SelectedWorkLog, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
           >
        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="Author" AllowColumnFiltering="False"  AllowEditing="False" BestFitMode="AllRows"/>
            <dxg:GridColumn FieldName="CreateDate"  AllowColumnFiltering="False" AllowEditing="False"/>
            <dxg:GridColumn FieldName="StartDate" AllowColumnFiltering="False" AllowEditing="False"/>
            <dxg:GridColumn FieldName="TimeSpent" AllowColumnFiltering="False" AllowEditing="False"/>
            <dxg:GridColumn FieldName="Comment" AllowColumnFiltering="False" Width="239" AllowEditing="False"/>
        </dxg:GridControl.Columns>

        <dxg:GridControl.View >
            <dxg:TableView ShowTotalSummary="True" 
                           ShowGroupPanel="False" 
                           MinWidth="750"
                           MaxWidth="750"
                           AllowCascadeUpdate="True"/>
        </dxg:GridControl.View>
    </dxg:GridControl>
    <Border BorderBrush="#FF85A0C7"
            BorderThickness="3" 
            CornerRadius="6"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            MinWidth="300"
            DockPanel.Dock="Right"

            >
        <dxl:FlowLayoutControl 
        ItemTemplate="{StaticResource borderdataTemplate}"
        DockPanel.Dock="Left" 
        HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            Background="#FFDBE6EE" 
            >

            <dxl:LayoutItem  Label="Time Spent[Daily]">
                <TextBox 
                    Width="100" 
                     x:Name="TimeSpent" 
                     HorizontalAlignment="Left" 

                     Text="{Binding Path= TimeSpent,
                    Mode=TwoWay,
                    UpdateSourceTrigger=PropertyChanged,
                    ValidatesOnDataErrors=True

                    }"
                         Margin="8,0,0,5"
                         />

            </dxl:LayoutItem>
            <Label Content="[eg, 2h,1w,10m]" 
                   Height="23" 
                   Width="90" 
                   VerticalAlignment="Top" 
                   Margin="200,-27,-236,0"/>

            <dxl:LayoutItem Label="Date Started" Margin="26,2,-26,-2" >
                <dxe:DateEdit Width="130"
                              x:Name="StartDate" MaskType="DateTime"
                          Mask="MM-dd-yyyy HH:mm"
                          DisplayFormatString="MM-dd-yyyy HH:mm"
                          ShowWeekNumbers="True"
                              MinValue="01-01-2013"
                          DateTime="{Binding Path=StartDate, Mode=TwoWay}"
                           ValidateOnTextInput="True"
                              ValidateOnEnterKeyPressed="True"
                              Margin="8,0,0,5"
                          >


                </dxe:DateEdit>

            </dxl:LayoutItem>

            <dxl:LayoutItem Label="Periodic Work Log" 
                            Margin="0,3,0,0" 
                            HorizontalAlignment="Right">
                <dxe:CheckEdit Margin="8,3,0,0"
                               x:Name="PeriodicLog"
                               IsChecked="{Binding Path=PeriodLog, Mode=OneWayToSource}">

                </dxe:CheckEdit>
            </dxl:LayoutItem>
            <dxl:LayoutItem Label="Date End" Margin="42,9,-42,-28">
                <dxe:DateEdit Width="130" 
                          x:Name="EndDate"
                          MaskType="DateTime"
                          Mask="MM-dd-yyyy HH:mm"
                          MinValue="01-01-2013"
                          DateTime="{Binding Path=EndDate, Mode=TwoWay}"
                          DisplayFormatString="MM-dd-yyyy HH:mm"
                          ShowWeekNumbers="True"
                              IsEnabled="{Binding ElementName=PeriodicLog,Path=IsChecked}"
                          ValidateOnEnterKeyPressed="True"
                          ValidateOnTextInput="True"
                          Margin="8,0,0,5"
                          ></dxe:DateEdit>

            </dxl:LayoutItem>


            <dxl:LayoutItem Label="Work Description"  Margin="8,35,0,-52" HorizontalAlignment="Stretch">
                <dxe:TextEdit x:Name="comment" 
                              Width="200" 
                              Height="100" 
                              Margin="5,0,0,0"
                              HorizontalAlignment="Stretch"
                              Text="{Binding Path=Comment, Mode=TwoWay}"
                              TextWrapping="Wrap"
                              VerticalContentAlignment="Top"
                              ></dxe:TextEdit>
            </dxl:LayoutItem>

            <Button  
                    Content="Add New"
                Width="70" 
                    Height="30"
                x:Name="AddLogWork" 
                IsEnabled="{Binding Path=EnableAdd, Mode=OneWay}"
                Margin="68,80,-80,-81"
                Command="{Binding UpdateLogCommand }"
                IsDefault="True">

            </Button>
            <Button Content="Cancel" 
                    HorizontalAlignment="Left" 
                    Height="30" 
                    VerticalAlignment="Top" 
                    Width="60" 
                    Margin="225,49,0,14"
                    Command="{Binding CancelCommand}"
                   />
            <Button Content="Delete" 
                    Height="30" 

                    VerticalAlignment="Top" 
                    Width="60" 
                    Margin="150,-49,0,-258" 
                    Command="{Binding DeleteLogCommand}" 
                    IsEnabled="{Binding Path=EnableDelete}"
                    />



        </dxl:FlowLayoutControl>
    </Border>

</DockPanel>

当前,当窗口调整大小时,dockpanels的最后一个控件将根据dockpanels的属性调整大小。 我希望在调整窗口大小时也调整GridControl的大小。 如何做到这一点。任何不同的面板或某些属性。请帮忙