Xamarin.forms 使用xamarin表单在代码隐藏中为ResourceDictionary内的标签赋值
我正在使用xamarin.forms 我在xaml页面中使用以下代码:Xamarin.forms 使用xamarin表单在代码隐藏中为ResourceDictionary内的标签赋值,xamarin.forms,Xamarin.forms,我正在使用xamarin.forms 我在xaml页面中使用以下代码: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:Syncfusion ="clr-n
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Syncfusion ="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms"
x:Class="MyProject.View.WOList">
<ContentPage.Resources>
<ResourceDictionary>
<DataTemplate x:Key="weathertemplate">
<Grid HorizontalOptions="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label x:Name="txtopen" Text="{Binding Date.Day}" HorizontalOptions="Center" TextColor="Black" HorizontalTextAlignment="Center" FontSize="16" />
....
</Grid>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
...
</ContentPage.Content>
</ContentPage>
....
...
我想为代码隐藏上的标签(x:Name=“txtopen”)指定“文本”。但是“txtopen”后面的代码没有显示
请帮助我解决此问题。您有一个绑定,为什么不在ViewModel级别设置默认值?我想在按钮单击操作上再次指定其他值。数据绑定已就绪。。再次说明为什么不使用它?我想更改按钮单击时特定标签的不同背景颜色。使用IValueConverter=>