יום ראשון, 10 באפריל 2011

WPF - Set


Just example of creating Style for specific Control Type, 
but with very IMPORTANT tip:

Don't specify x:Key value - it's doesn't work:

<UserControl.Resources>
        <Style TargetType="{x:Type Label}">
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Background" Value="Transparent"/>                    
        </Style>
    </UserControl.Resources>
    
    <StackPanel Name="MainStackPanel">
        <Grid x:Name="CondensedPanel" Visibility="Collapsed">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.02*"/>
                <ColumnDefinition Width="30"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Grid.Column="1" x:Name="txtCondensed" Content="שם: "></Label>
            <Label Grid.Column="2" x:Name="lblCondensed" Content="{Binding ld_name}"></Label>
            ....

Thank You,
Enjoy! 

אין תגובות:

הוסף רשומת תגובה