Search code examples
xamluwpuwp-xamlwindows-community-toolkit

How to change header text align to right in Date Picker UWP


<DatePicker x:Name="PatientDateOfBirthPicker"
                    SelectedDateChanged="PatientDateOfBirthPicker_SelectedDateChanged"
                    Header="بەرواری لە دایک بوون"
                    DayFormat="day"
                    MonthFormat="{}{month.integer}"
                    YearFormat="{}{year.full(4)}"
                    YearVisible="True"
                    FontFamily="NRT Reg"
                    FontSize="18" 
                    FlowDirection="RightToLeft"
                    Width="400">
        </DatePicker>

How to change header text align to right tried both FlowDirection="RightToLeft" and FlowDirection="LeftToRight" it give me the same result

this is my result


Solution

  • @Mark Feldman's answer is correct. You just need to change the header of the DataPicker and set the FlowDirection to RightToLeft

    The code:

     <DatePicker x:Name="PatientDateOfBirthPicker"
                    
                    DayFormat="day"
                    MonthFormat="{}{month.integer}"
                    YearFormat="{}{year.full(4)}"
                    YearVisible="True"
                    FontFamily="NRT Reg"
                    FontSize="18" 
                    FlowDirection="RightToLeft"
                    Width="400">
            <DatePicker.Header>
                <TextBlock Text="بەرواری لە دایک بوون" FlowDirection="RightToLeft" />
            </DatePicker.Header>
        </DatePicker>
    

    The result: enter image description here