Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XAML Right Align Grid column
Message
De
07/01/2013 12:22:17
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
XAML Right Align Grid column
Divers
Thread ID:
01561598
Message ID:
01561598
Vues:
56
Hi,

I have the following Datagrid defined:
                        <DataGrid AutoGenerateColumns="False" Grid.Row="5" Grid.Column="1" Height="Auto" HorizontalAlignment="Stretch" Margin="0" Name="grdInvoiceDetails" VerticalAlignment="Stretch" Width="Auto" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Mode=default}" SelectionMode="Single" GridLinesVisibility="None" HeadersVisibility="Column" Grid.ColumnSpan="2" Style="{DynamicResource HDSDataGridStyle}" CanUserAddRows="False" CanUserDeleteRows="False" SelectionUnit="Cell" Grid.RowSpan="1">
                            <DataGrid.Columns>
                                <DataGridComboBoxColumn Header="Charge Type" Width="*" DisplayMemberPath="cty_name" SelectedValuePath="cty_pk" SelectedValueBinding="{Binding ivd_ctyfk, Mode=Default}"/>
                                <DataGridTextColumn Header="Amount" Width="*" Binding="{Binding ivd_amount, Mode=default}"/>
                            </DataGrid.Columns>
                        </DataGrid>
I want the second column to be right aligned. I found this suggestion on the net:
<UserControl.Resources>
      <Style x:Key="AlignRight" TargetType="Data:DataGridCell">
          <Setter Property="HorizontalContentAlignment" Value="Right" />
     </Style>
</UserControl.Resources> 

<Data:DataGridTextColumn Header="Amount" Width="90" Binding="{Binding Amount}" IsReadOnly="True" CellStyle="{StaticResource AlignRight}"></Data:DataGridTextColumn> 
If I try this I get this error:

The attachable property 'Resources' was not found in type 'UserControl'.

Can anyone explain this to me please?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform