WP7 Set Datepicker Border Color

I'm having trouble adjusting the border color in the Toolkit Datepicker as it appears on the page. I am not talking about DatePickerPage. I can set the background and foreground color, but the border is not held.

<toolkit:DatePicker x:Name="dpDeliverBy" Header="Deliver By" Grid.Row="6" 
HeaderTemplate="{StaticResource MyHeaderTemplate}" Margin="-12, 0, 0, -10" Value=""
BorderBrush="Black" Background="White" BorderThickness="2" Foreground="Black" />

The border doesn't seem to be capturing, and I don't know which other property to use.

+3
source share
2 answers

Interestingly, you cannot edit the template DatePicker. I found out by looking at the source code , which for some reason arises because the template is defined in the main control topic - Generic.xamland it does not have a property BorderBrushdefined per se.

- .

, DatePicker, BorderBrush BorderThickness. , - , , ( ). , Microsoft.Phone.Controls.Toolkit, , GAC ( , ) , SDK . , .

, .

( ):

<Style TargetType="controls:DatePicker">
    <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="BorderBrush" Value="Azure"/>
    <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="PickerPageUri" Value="/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/DatePickerPage.xaml"/>
    <Setter Property="ValueStringFormat" Value="{}{0:d}"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="controls:DatePicker">
                <StackPanel>
                    <ContentControl
                        Content="{TemplateBinding Header}"
                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                        Foreground="{StaticResource PhoneSubtleBrush}"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        Margin="12,0,12,-4"/>
                    <Button
                        x:Name="DateTimeButton"
                        Content="{TemplateBinding ValueString}"
                        Background="{TemplateBinding Background}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        FontFamily="{TemplateBinding FontFamily}"
                        Foreground="{TemplateBinding Foreground}"
                        Height="72"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
+6

Silverlight Toolkit, . , , , XAML: " ". , XAML Themes\generic.xaml.

XAML , , , . , , , App.xaml, Toolkit, .

VSJ, , .

+4

Source: https://habr.com/ru/post/1789888/


All Articles