teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

該当ソースコード追加と前提の追加

2020/01/10 06:45

投稿

DS10
DS10

スコア5

title CHANGED
File without changes
body CHANGED
@@ -2,10 +2,14 @@
2
2
  Visual Studio 2019 for Macを使用し、
3
3
  Xamarinでスマートフォン向けアプリを作成しています。
4
4
 
5
+ xamlで宣言したラベルに対して、
5
- xaml.cs側でラベルのテキストなどに、値を入れる際に
6
+ xaml.cs側でテキストなどに、値を入れる際に
6
7
  「testPage.LblMessage'と'testPage.LblMessage'間があいまいです。」
7
8
  と同じクラス間であいまいとエラーが出てしまいます。
8
9
 
10
+ xaml側で宣言した全てのコントロールのプロパティに値を入れる際に、
11
+ エラーが発生しています。
12
+
9
13
  解決するにはどのようにすればよろしいのでしょうか?
10
14
 
11
15
  ### 発生している問題・エラーメッセージ
@@ -16,6 +20,67 @@
16
20
 
17
21
  ### 該当のソースコード
18
22
 
19
- ```C#
23
+ ```c#
24
+ //xaml
25
+ <?xml version="1.0" encoding="UTF-8"?>
26
+ <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
27
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
28
+ x:Class="test.Views.GroupCreatingPage">
29
+ <StackLayout Orientation="Vertical"
30
+ Spacing="20"
31
+ VerticalOptions="CenterAndExpand"
32
+ HorizontalOptions="CenterAndExpand">
33
+ <Image Source="blue_folder.png" WidthRequest="200" HeightRequest="200"/>
34
+ <Entry x:Name="edtGroupName"
35
+ FontSize="Large"
36
+ HorizontalTextAlignment="Start"
37
+ HorizontalOptions="FillAndExpand"
38
+ VerticalOptions="Center" />
39
+ <StackLayout Orientation="Horizontal"
40
+ Spacing="20">
41
+ <Button x:Name="BtnChange"
42
+ VerticalOptions="Center"
43
+ BackgroundColor="#e0e2e5"
44
+ BorderColor="#e0e2e5"
45
+ BorderWidth="1"
46
+ TextColor="Black"
20
- LblMessage.Text = "test";
47
+ WidthRequest="150"
48
+ Clicked="OkButtonClicked" />
49
+
50
+ <Button x:Name="BtnCancel"
51
+ VerticalOptions="Center"
52
+ BackgroundColor="#e0e2e5"
53
+ BorderColor="#e0e2e5"
54
+ BorderWidth="1"
55
+ TextColor="Black"
56
+ WidthRequest="150"
57
+ Clicked="CancelButtonClicked" />
58
+ </StackLayout>
59
+ </StackLayout>
60
+ </ContentPage>
61
+
62
+
63
+ //xmal.cs
64
+ public partial class GroupCreatingPage : ContentPage
65
+ {
66
+ CarLocker CarLockers;
67
+
68
+ public GroupCreatingPage(CarLocker car)
69
+ {
70
+ InitializeComponent();
71
+ CarLockers = car;
72
+
73
+ BtnChange.Text = AppResources.Button_Change;//エラー発生箇所
74
+ BtnCancel.Text = AppResources.Button_Cancel;//エラー発生箇所
75
+ if (CarLockers != null)
76
+ {
77
+ edtGroupName.Text = CarLockers.CarNumber;//エラー発生箇所
78
+ }
79
+ else
80
+ {
81
+ edtGroupName.Text = "";//エラー発生箇所
82
+ }
83
+ edtGroupName.TextChanged += EdtGroupName_TextChanged;//エラー発生箇所
84
+ }
85
+ }
21
86
  ```