Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to assign one style in runtime?

$
0
0

Hi ya there,

This thread is PreviousThread related to.

That's my general styles file:

    <Style x:Key="EnglishDatePicker" TargetType="{x:Type DatePicker}">
        <Setter Property="Text"  Value="Select a date" />
    </Style>

    <Style x:Key="SpanishDatePicker" TargetType="{x:Type DatePicker}">
        <Setter Property="Text"  Value="Seleccionar una fecha" />
    </Style>

And I would like to assing under culture basis:

XAML definition:

  <DatePicker Style="{StaticResource EnglishDatePicker}" x:Name="FCaducidad" Grid.Column="1" HorizontalAlignment="Left" Margin="10,36,0,0"/>

Code-behind:

If CultureManager.UICulture = "ES" then: FCaducidad.Style = SpanishDatePicker???

Else: FCaducidad.Style = ???

Endif

How can I proceed in order to translate its contents???

Thanks a lot,


Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF/SilverLight projects.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>