有人知道为什么只有第二个isvisible
转换器被调用吗?
如果我更改了序列,则只调用新的第二个转换器
Converter1为DiaryTypeNahrungsaufnahmeToBoolConverter
,converter2为DiaryTypeAuswirkungToBoolConverter
。
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<RelativeLayout IsVisible="{Binding Type, Converter={StaticResource converter1}}"></RelativeLayout>
<RelativeLayout IsVisible="{Binding Type, Converter={StaticResource converter2}}"></RelativeLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
转换器代码是:
public class DiaryTypeNahrungsaufnahmeToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
if (value is LibChemotherapie.DiaryType)
{
return ((LibChemotherapie.DiaryType)value) == LibChemotherapie.DiaryType.Food;
}
return false;
}
catch (Exception)
{
return false;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class DiaryTypeAuswirkungToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
if (value is LibChemotherapie.DiaryType)
{
return ((LibChemotherapie.DiaryType)value) == LibChemotherapie.DiaryType.Effect;
}
return false;
}
catch (Exception)
{
return false;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
感谢您的帮助。
答案 0 :(得分:0)
根据杰森的暗示,它现在正在工作!我更改了xaml,因此ViewCell只包含一个视图。在那个视图中,我添加了两个相对布局和绑定属性。
str(dades$Edat)
num [1:30000] 24 26 34 37 57 37 29 23 28 35 ...