@דוד ל.ט.
אם תשים ברייקפוינט במתודה Convert תראה שהValue תואם לסוג של השורה. ממנו תנסה להסיק בקוד רשימה מתאימה של אמצעי תשלום ולהחזיר אותם כרשימה (עם מאפיין ID כמובן לאיגוד לטבלה).
לא הצלחתי כלל להריץ את התכנית, כתבתי כמו שאמרת והוא כותב שהמחלקה שלי לא נמצאת בניימספייס, וזה תמוה כי היא כן!!
הנה הקוד זאמל:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TrialSQL1" x:Class="TrialSQL1.AddTruma"
Title="AddTruma" MinHeight="400" MinWidth="900" Loaded="Window_Loaded" FlowDirection="RightToLeft">
<Window.Resources>
<local:MethodToListPay x:Key="MethodToListPay"/>
<CollectionViewSource x:Key="donoationViewSource" Source="{Binding Donoation, Source={StaticResource avrTrumaDataSet}}"/>
</Window.Resources>
....
<DataGridTemplateColumn x:Name="howToPayColumn" Header="אופן התשלום" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Converter={StaticResource MethodToListPay}}">
<ComboBoxItem Content="{Binding HowToPay}"/>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn x:Name="idMethodPayColumn" Header="מזהה אמצעי תשלום" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox>
<ComboBoxItem Content="{Binding IdMethodPay}"/>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
והנה הקוד של המחלקה (שעדיין לא כתבתי את הפונקציה.. אבל אפשר לראות שהיא באותו ניימספייס..)
namespace TrialSQL1
{
public class MethodToListPay : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
השתגע הבחור!!
פתאום הוא גם טוען שהוא לא מכיר את הדטהסט, למרות שלפני זה הכל עבד והוא הכיר אותו יפה מאד??
ולא מחקתי כלום..
פורסם במקור בפורום CODE613 ב21/07/2015 23:01 (+03:00)