@@ -14,29 +14,28 @@ public sealed class FeedbackView : Window, IViewFor<FeedbackViewModel>, IDisposa
1414 {
1515 private readonly CompositeDisposable _subscriptions = [ ] ;
1616
17- public FeedbackView ( FeedbackViewModel viewModel ) :
18- base ( new Rect ( 0 , 0 , 30 , 20 ) )
17+ public FeedbackView ( FeedbackViewModel viewModel )
1918 {
2019 ViewModel = viewModel ;
2120 ViewModel . Activator . Activate ( ) ;
2221 this . StackPanel ( TimeElapsedLabel ( ) )
23- . Append ( new Label ( "Issue Title" ) )
22+ . Append ( new Label ( ) { Text = "Issue Title" } )
2423 . Append ( TitleDescription ( ) )
2524 . Append ( TitleInput ( ) )
26- . Append ( new Label ( "Issue Description" ) )
25+ . Append ( new Label ( ) { Text = "Issue Description" } )
2726 . Append ( MessageDescription ( ) )
2827 . Append ( MessageInput ( ) )
29- . Append ( new Label ( "Feedback Type" ) )
28+ . Append ( new Label ( ) { Text = "Feedback Type" } )
3029 . Append ( IssueCheckBox ( ) )
3130 . Append ( IdeaCheckBox ( ) )
32- . Append ( new Label ( "Feedback Category" ) )
31+ . Append ( new Label ( ) { Text = "Feedback Category" } )
3332 . Append ( SectionRadioGroup ( ) )
34- . Append ( new Button ( "Send Feedback" ) , 4 ) ;
33+ . Append ( new Button ( ) { Text = "Send Feedback" } , 4 ) ;
3534 }
3635
3736 private RadioGroup SectionRadioGroup ( )
3837 {
39- var radioGroup = new RadioGroup ( [ "User Interface" , "Audio" , "Video" , "Voice" ] ) ;
38+ var radioGroup = new RadioGroup ( ) { RadioLabels = [ "User Interface" , "Audio" , "Video" , "Voice" ] } ;
4039 this . WhenAnyValue ( x => x . ViewModel . Section )
4140 . BindTo ( radioGroup , x => x . SelectedItem )
4241 . DisposeWith ( _subscriptions ) ;
@@ -51,13 +50,14 @@ private RadioGroup SectionRadioGroup()
5150
5251 private CheckBox IssueCheckBox ( )
5352 {
54- var item = new CheckBox ( "Issue" , ViewModel . Issue ) ;
53+ var item = new CheckBox ( ) { Text = "Issue" , State = ViewModel . Issue ? CheckState . Checked : CheckState . UnChecked } ;
5554 this . WhenAnyValue ( x => x . ViewModel . Issue )
56- . BindTo ( item , x => x . Checked )
55+ . Select ( issue => issue ? CheckState . Checked : CheckState . UnChecked )
56+ . BindTo ( item , x => x . State )
5757 . DisposeWith ( _subscriptions ) ;
5858 item . Events ( )
59- . Toggled
60- . Select ( args => item . Checked )
59+ . Toggle
60+ . Select ( args => args . NewValue == CheckState . Checked )
6161 . BindTo ( this , x => x . ViewModel . Issue )
6262 . DisposeWith ( _subscriptions ) ;
6363 this . WhenAnyValue ( x => x . ViewModel . Idea )
@@ -69,13 +69,14 @@ private CheckBox IssueCheckBox()
6969
7070 private CheckBox IdeaCheckBox ( )
7171 {
72- var item = new CheckBox ( "Suggestion" , ViewModel . Idea ) ;
72+ var item = new CheckBox ( ) { Text = "Suggestion" , State = ViewModel . Idea ? CheckState . Checked : CheckState . UnChecked } ;
7373 this . WhenAnyValue ( x => x . ViewModel . Idea )
74- . BindTo ( item , x => x . Checked )
74+ . Select ( issue => issue ? CheckState . Checked : CheckState . UnChecked )
75+ . BindTo ( item , x => x . State )
7576 . DisposeWith ( _subscriptions ) ;
7677 item . Events ( )
77- . Toggled
78- . Select ( old => item . Checked )
78+ . Toggle
79+ . Select ( args => args . NewValue == CheckState . Checked )
7980 . BindTo ( this , x => x . ViewModel . Idea )
8081 . DisposeWith ( _subscriptions ) ;
8182 this . WhenAnyValue ( x => x . ViewModel . Issue )
@@ -87,7 +88,7 @@ private CheckBox IdeaCheckBox()
8788
8889 private Label TimeElapsedLabel ( )
8990 {
90- var label = new Label ( "0 seconds passed" ) ;
91+ var label = new Label ( ) { Text = "0 seconds passed" } ;
9192 this . WhenAnyValue ( x => x . ViewModel . Elapsed )
9293 . Select ( elapsed => ( ustring ) $ "{ elapsed } seconds passed")
9394 . BindTo ( label , x => x . Text )
@@ -97,7 +98,7 @@ private Label TimeElapsedLabel()
9798
9899 private TextField MessageInput ( )
99100 {
100- var text = new TextField ( ViewModel . Message ) ;
101+ var text = new TextField ( ) { Text = ViewModel . Message , Width = 40 } ;
101102 this . WhenAnyValue ( x => x . ViewModel . Message )
102103 . BindTo ( text , x => x . Text )
103104 . DisposeWith ( _subscriptions ) ;
@@ -112,7 +113,7 @@ private TextField MessageInput()
112113
113114 private Label MessageDescription ( )
114115 {
115- var label = new Label ( $ "0 letters used from { ViewModel . MessageLengthMax } ") ;
116+ var label = new Label ( ) { Text = $ "0 letters used from { ViewModel . MessageLengthMax } " } ;
116117 this . WhenAnyValue ( x => x . ViewModel . MessageLength , x => x . ViewModel . MessageLengthMax )
117118 . Select ( values => ( ustring ) $ "{ values . Item1 } letters used from { values . Item2 } ")
118119 . BindTo ( label , x => x . Text )
@@ -122,7 +123,7 @@ private Label MessageDescription()
122123
123124 private TextField TitleInput ( )
124125 {
125- var text = new TextField ( ViewModel . Title ) ;
126+ var text = new TextField ( ) { Text = ViewModel . Title , Width = 40 } ;
126127 this . WhenAnyValue ( x => x . ViewModel . Title )
127128 . BindTo ( text , x => x . Text )
128129 . DisposeWith ( _subscriptions ) ;
@@ -137,7 +138,7 @@ private TextField TitleInput()
137138
138139 private Label TitleDescription ( )
139140 {
140- var label = new Label ( $ "0 letters used from { ViewModel . TitleLengthMax } ") ;
141+ var label = new Label ( ) { Text = $ "0 letters used from { ViewModel . TitleLengthMax } " } ;
141142 this . WhenAnyValue ( x => x . ViewModel . TitleLength , x => x . ViewModel . TitleLengthMax )
142143 . Select ( values => ( ustring ) $ "{ values . Item1 } letters used from { values . Item2 } ")
143144 . BindTo ( label , x => x . Text )
0 commit comments