Binding and style doesn't work for Win8?

前端 未结 2 1042
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-16 05:17

I derived from a TextBox and called it MyTextBox. On my LayoutAwarePage I created 2 SolidColorBrush props: MyBackground and MyBorder. In the Xaml of that page I wrote a Reso

相关标签:
2条回答
  • 2021-01-16 05:55
    <Grid.Resources>
            <ResourceDictionary>
                <Style TargetType="a:MyTextBox">
                    <Setter Property="Background" Value="{StaticResource MyBackground}"></Setter>
                    <Setter Property="BorderBrush" Value="{StaticResource MyBorder}"></Setter>
                    <Setter Property="Width" Value="200"></Setter>
                    <Setter Property="IsReadOnly" Value="False"></Setter>
                    <Setter  Property="BorderBrush" Value="3"></Setter>
                </Style>
            </ResourceDictionary>
        </Grid.Resources>
    

    Try this

    And inside App.xaml do <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Common/StandardStyles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary>

    And create a file called standard styles inside your common dir and declare your brushes there (you can actually declare everything there

    0 讨论(0)
  • 2021-01-16 06:03

    Binding in Style Setters is not supported in WinRT.

    0 讨论(0)
提交回复
热议问题