|
WPF,ENUM,MVVM,COMBOBOX
|
|||
---|---|---|---|
#18+
Есть два списка Тип образования и квалификация. Нужно их связать и выдать в комбобоксы. Вроде все просто, но я что-то совсем запутался... и так текст проги: списки: public enum Type { Course = 0, School = 1, Lyceum = 2, University = 3, Academy = 4, Institute = 5, Conservatory = 6, College = 7 } public class tandQt { public enum Qt { None = 0, Bachelor = 1, Specialist = 2, Master = 3, } public List<Qt> getlistqy(Type _type) { List<Qt> returngetlistqy = new List<Qt>(); if (_type == Type.Course || _type == Type.School || _type == Type.Lyceum) returngetlistqy.Add(Qt.None); if (_type == Type.University || _type == Type.Institute || _type == Type.Academy || _type == Type.College || _type == Type.Conservatory) { returngetlistqy.Add(Qt.Bachelor); returngetlistqy.Add(Qt.Specialist); returngetlistqy.Add(Qt.Master); } return returngetlistqy; } } Viewmodel: private IEnumerable<Type> _type; IEnumerable<Type> TypeEducation { get { return Enum.GetValues(typeof(Type)).Cast<Type>(); } set { _type = value; this.OnPropertyChanged("type"); } } Биндинг для первого комбобокса <ComboBox x:Name="Type" Grid.Column="2" Grid.Row="2" Height="20" VerticalAlignment="Top" Margin="4,6,0,0" ItemsSource="{Binding TypeEducation, Mode=OneWay}" > <ComboBox.Text> <Binding Path="Edu.type" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" ValidatesOnDataErrors="True" > </Binding> </ComboBox.Text> </ComboBox> Вот теперь что то запутался, как описать процедуру во viewmodel для второго комбобокса ... |
|||
:
Нравится:
Не нравится:
|
|||
21.12.2012, 20:39 |
|
|
start [/forum/topic.php?fid=21&fpage=34&tid=1441546]: |
0ms |
get settings: |
9ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
39ms |
get topic data: |
10ms |
get forum data: |
2ms |
get page messages: |
26ms |
get tp. blocked users: |
1ms |
others: | 314ms |
total: | 422ms |
0 / 0 |