Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

can put a simple button just above a datagrid

$
0
0

I'm very new to xaml.  I have struggled and struggled and I can't get a button to sit just above a datagrid.  When I put one there, it actually ends up underneath and not seen.  I have tried everything I can think of, with no luck.

<UserControl x:Class="DocumentListing"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">

    <DockPanel Width="Auto" LastChildFill="False" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid>
            <Border BorderThickness="0,0,0,0" Width="Auto" Height="Auto" DockPanel.Dock="Top,Left"  >
                <Grid>
                        <DataGrid Name="dataGrid1" IsReadOnly="True" AutoGenerateColumns="False"
                      AlternatingRowBackground="#eee">
                            <DataGrid.ColumnHeaderStyle>
                                <Style TargetType="{x:Type DataGridColumnHeader}">
                                    <Setter Property="FontWeight"
                                    Value="Bold" />
                                    <Setter Property="Background" Value="#d0d0d0" />
                                    <Setter Property="Height" Value="35" />
                                    <Setter Property="Padding" Value="4"/>
                                    <Setter Property="HorizontalContentAlignment" Value="Center" />
                                </Style>
                            </DataGrid.ColumnHeaderStyle>
                            <DataGrid.Columns>
                                <DataGridTemplateColumn>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Click="ViewButtonClick" Tag="{Binding Path=RecNumber}"
                                                        VerticalAlignment="Center" 
                                                        HorizontalAlignment="Center"
                                                        Width="23" 
                                                        Height="23" >
                                                <Image Source="/RbdmsWpfControlsBase;component/images/View.png" />
                                            </Button>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTextColumn Header="Document Name" Binding="{Binding Title}" MinWidth="300"></DataGridTextColumn>
                                <DataGridTextColumn Header="Type" Binding="{Binding FileExtension}" MinWidth="50"></DataGridTextColumn>
                                <DataGridTextColumn Header="Upload Date" Binding="{Binding DateCreated}" MinWidth="100"></DataGridTextColumn>
                            </DataGrid.Columns>
                        </DataGrid>
            </Grid>
            </Border>
        </Grid>
    </DockPanel>
</UserControl>


Stockton


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>