请问一个布局
请教一个布局
问题:怎么让¥1右对齐?
最外面是一个StackPanel(spBorder)
垂直布局,上面是图片,下面是文字
下面文字我要让油条左对齐,让¥1右对齐,我又建了一个StackPanel,在里面放了两个TextBlock
StackPanel spBorder = new StackPanel(); //spBorder
Image image = new Image(); //spBorder.child1
image.Source = new BitmapImage(new Uri("images/" + dr["Image_Path"] + "", UriKind.Relative));
StackPanel spBreakfast = new StackPanel(); //spBorder.child2
spBreakfast.Orientation = Orientation.Horizontal;
TextBlock tb1 = new TextBlock();
tb1.Text = dr["Dish_Name"].ToString();
tb1.FontSize = 20;
//TextBlock tb3 = new TextBlock();
//tb3.Text = " ";
TextBlock tb2 = new TextBlock();
tb2.Text = "¥" + dr["Price"];
tb2.FontSize = 20;
tb2.Foreground = Brushes.Red;
spBreakfast.Children.Add(tb1);
//spBreakfast.Children.Add(tb3);
spBreakfast.Children.Add(tb2);
spBorder.Children.Add(image);
spBorder.Children.Add(spBreakfast);
------解决思路----------------------
用textbox 不允许编辑 这控件好像有那个属性
问题:怎么让¥1右对齐?
最外面是一个StackPanel(spBorder)
垂直布局,上面是图片,下面是文字
下面文字我要让油条左对齐,让¥1右对齐,我又建了一个StackPanel,在里面放了两个TextBlock
StackPanel spBorder = new StackPanel(); //spBorder
Image image = new Image(); //spBorder.child1
image.Source = new BitmapImage(new Uri("images/" + dr["Image_Path"] + "", UriKind.Relative));
StackPanel spBreakfast = new StackPanel(); //spBorder.child2
spBreakfast.Orientation = Orientation.Horizontal;
TextBlock tb1 = new TextBlock();
tb1.Text = dr["Dish_Name"].ToString();
tb1.FontSize = 20;
//TextBlock tb3 = new TextBlock();
//tb3.Text = " ";
TextBlock tb2 = new TextBlock();
tb2.Text = "¥" + dr["Price"];
tb2.FontSize = 20;
tb2.Foreground = Brushes.Red;
spBreakfast.Children.Add(tb1);
//spBreakfast.Children.Add(tb3);
spBreakfast.Children.Add(tb2);
spBorder.Children.Add(image);
spBorder.Children.Add(spBreakfast);
------解决思路----------------------
用textbox 不允许编辑 这控件好像有那个属性