0
WindowsPhone에서 앱 개발을 시작하고 몇 가지 문제가 있습니다. 동적으로 캔버스를 추가하려고했지만 작동하지 않아 뭔가를 잊어 버렸을 수 있습니다. 오류를 발견하는 데 도움이 될 수 있습니까? 아래 코드는 내 학습 앱에서 가져온 것입니다. 기본 Win Phone 앱입니다.동적으로 캔버스 만들기
CS 코드 :
public MainPage()
{
InitializeComponent();
int size = 50;
Canvas myCanvas = new Canvas();
Canvas.SetLeft(myCanvas, 0);
myCanvas.Width = size;
Color c = new Color();
c.R = 255;
c.B = 0;
c.G = 255;
myCanvas.Background = new SolidColorBrush(c);
ContentPanel.Height = 100;
ContentPanel.Width = 100;
ContentPanel.Children.Add(myCanvas);
ApplicationTitle.Text = ContentPanel.ActualHeight.ToString();
}
XAML 난 당신이 캔버스 여기 달성하기 위해 노력하고 무엇을 아주 확실하지 않다
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
</Grid>
</Grid>
덕분에, 당신은 내 일했다. –
도와 드리겠습니다. 게임에 행운을 비네! – Robaticus