MahApps.Metro icon indicating copy to clipboard operation
MahApps.Metro copied to clipboard

DatePicker inside DataTemplate, FontSize Question

Open shadowaltar opened this issue 12 years ago • 0 comments

I notice that the if a DatePicker is put inside a DataTemplate (in my case, a template in DataGridTemplateColumn.CellTemplate), no matter what FontSize is set it will always be around size 15:

<DataGrid.Columns>
    <DataGridTemplateColumn Header="Benchmark" IsReadOnly="True" Width="*">
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <ComboBox ItemsSource="{Binding DataContext.Benchmarks, RelativeSource={RelativeSource AncestorType=DataGrid}}"
                          SelectedValue="{Binding Benchmark}"
                          FontSize="15"/>
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
    <DataGridTemplateColumn Header="Effective Date" Width="*">
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <DatePicker Margin="5" HorizontalAlignment="Stretch"
                            SelectedDate="{Binding EffectiveDate, UpdateSourceTrigger=PropertyChanged}"
                            FontSize="6"/>
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
</DataGrid.Columns>

while the FontSize of ComboBox for column 'Benchmark' works well.

Is it a bug or just my xaml's problem? Thanks.

shadowaltar avatar Mar 26 '14 03:03 shadowaltar