Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > WPF и Silverlight > NaN в своистве WPF


Автор: kobra 3.8.2009, 09:06
здравствуите господа

допустим имеем форму с двумья кнопками
Код

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Button Name="b1" Height="106" Margin="0,0,0,156" VerticalAlignment="Bottom">asefaserfqwefqwefw</Button>
        <Button Height="50" Margin="114,0,114,27" VerticalAlignment="Bottom" Click="Button_Click">asdas</Button>
    </Grid>
</Window>
Код

using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.b1.Content = this.b1.Width.ToString();
        }
    }
}
как выудить реалное значение b1.Width?

спосибо 

Автор: neiron 3.8.2009, 10:06
Button.ActualWidth - реальное настоящее значение ширины

Автор: kobra 3.8.2009, 10:37
спосибо

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)