Combo-Box #71
JLBLU
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Ahmad
I want a combo-box to display "Lundi" / "Mardi" (display values) but want to store "MONDAY" / "TUESDAY" (internal values) in my data source (column="ScheduleId").
For this, I have following class to handle my enumeration :
// At beginning of my application :
// So, If in my data source, I have stored "MONDAY' in comumn "ScheduleId", I want to see displayed value = 'Lundi"
// In my view XAML, I wanted to do :
<controlsTV:TableViewComboBoxColumn
x:Name="colSched"
Header="Planning"
Width="Auto"
ItemsSource="{x:Bind mod:DkAlarmSchedule.GetAlarmSchedules()}"
Binding="{Binding ScheduleId}"
DisplayMemberPath="ScheduleName"
/>
But, by doing this, displayed value is "MONDAY" (and not "Lundi") after view populate (OnNavigatedTo)
// To have a correct value displayed after load of my data source, I have to do :
1/ added a new attribute "ScheduleName" in my ViewModel
2/ modify xaml like this :
<controlsTV:TableViewComboBoxColumn
x:Name="colSched"
Header="Planning"
Width="Auto"
ItemsSource="{x:Bind mod:DkAlarmSchedule.GetAlarmSchedules()}"
Binding="{Binding ScheduleName}"
DisplayMemberPath="ScheduleName"
SelectedValuePath="ScheduleId"
SelectedValueBinding="{Binding ScheduleId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
/>
// I works, but not very nice. Is there a way to do it differently ?
best regards
Jean-Luc
Beta Was this translation helpful? Give feedback.
All reactions