Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / FilePicker / FilePicker Elements / Changing Text Alignment
In This Topic
    Changing Text Alignment
    In This Topic

    The C1FilePicker control typically displays the current file selected in the text area of the control. This text is aligned to the left by default, but you can change the text alignment if you choose. Text alignment can be set using the TextAlignment property, and options include Left (default), Center, or Right text alignment. For more information, see the steps below.

    To set the TextAlignment property to Right add TextAlignment="Right" to the <c1:C1FilePicker> tag so that it appears similar to the following:

     

    XAML
    Copy Code
    <c1:C1FilePicker HorizontalAlignment="Left" Margin="112,36,0,0" Name="C1FilePicker1" VerticalAlignment="Top" Width="161" TextAlignment="Right" />
    

    To set the TextAlignment property to Right, add the following code to your project:

    Visual Basic
    Copy Code
    Me.C1FilePicker1.TextAlignment = TextAlignment.Right
    
                   
    C#
    Copy Code
    this.c1FilePicker1.TextAlignment = TextAlignment.Right;
    

    To set the TextAlignment property to Right at design time, complete the following steps:

    1. Click the C1FilePicker control once to select it.
    2. Navigate to the Properties window and locate the TextAlignment item.
    3. Click the drop-down arrow next to the TextAlignment item and select Right.

     The text is now aligned to the right. Run the application and select a file. Notice that the name of the file is now aligned to the right in the C1FilePicker control: