WPF DevExpress之隐藏显示内容及窗口大小由内容决定

<Window x:Class="NavBarControl.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"     
        xmlns:local="clr-namespace:NavBarControl"
        Title="MainWindow" Width="525" SizeToContent="Height" Height="275">
    <Window.DataContext>
        <local:TestViewModel x:Name="testViewModel" />
    </Window.DataContext>
    <DockPanel>
        <Border DockPanel.Dock="Top" Margin="10" BorderBrush="Blue" BorderThickness="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="20"/>
                </Grid.RowDefinitions>
            </Grid>            
        </Border>
        <Expander Header="Recent Activity" Margin="8" IsExpanded="False">            
            <dxg:GridControl Margin="22,0,22,0" x:Name="grid" ItemsSource="{Binding ElementName=testViewModel, Path=Tests}" Foreground="Black" MinHeight="120" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FontFamily="Simsun">
                <dxg:GridControl.View>
                    <dxg:TableView Name="tableView" Foreground="Black" BestFitMode="Default" NavigationStyle="Row" AllowResizing="False" AllowDrop="False" ShowIndicator="False" AutoWidth="True" ShowGroupPanel="False" AllowEditing="False" AllowColumnFiltering="False">
                    </dxg:TableView>
                </dxg:GridControl.View>
                <dxg:GridControl.Columns>
                    <dxg:GridColumn FieldName="Name" Header="Name" MinWidth="25" Width="30" ReadOnly="True" AllowResizing="False" FixedWidth="true" HorizontalHeaderContentAlignment="Center" VisibleIndex="0"/>
                    <dxg:GridColumn FieldName="Desc" Header="Desc" MinWidth="60" Width="120" ReadOnly="True" AllowResizing="False" FixedWidth="true" HorizontalHeaderContentAlignment="Center" VisibleIndex="1" />
                </dxg:GridControl.Columns>
            </dxg:GridControl>
        </Expander>
    </DockPanel>
</Window>

 

posted on 2014-05-21 10:36  老有所依  阅读(589)  评论(0)    收藏  举报

导航