Программирование - это просто
Advertisement
arrow C# arrow Windows Presentation Foundation (WPF). arrow Windows Presentation Foundation (WPF). 3. XAML.
06.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
Windows Presentation Foundation (WPF). 3. XAML. E-mail
megabax   
07.02.2013 .
http

Windows Presentation Foundation (WPF). 3. XAML.

WPF :

Windows Presentation Foundation (WPF).  3.   XAML.

, , , HorizontalAlignment, XAML , .NET HorizontalAlignment Button , enum. , XAML . :

  • TypeConverter. , .

  • , XAML .
  • , .

.  , . , , , . ".". , " ". Background Grid   Grid.Background, :

    <Grid>

        <Grid.Background>

            <LinearGradientBrush>

                <LinearGradientBrush.GradientStops>

                    <GradientStop Offset="0.0" Color="Red"/>

                    <GradientStop Offset="0.5" Color="Indigo"/>

                    <GradientStop Offset="1.5" Color="Violet"/>

                </LinearGradientBrush.GradientStops>

            </LinearGradientBrush>

        </Grid.Background>

        <Button Content="" Height="23" HorizontalAlignment="Left" Margin="88,41,0,0" Name="MyButton" VerticalAlignment="Top" Width="75" />

    </Grid>

:

Windows Presentation Foundation (WPF).  3.   XAML.

. "":

        private void MyButton_Click(object sender, RoutedEventArgs e)

        {

            LinearGradientBrush brush = new LinearGradientBrush();

 

            GradientStop stop = new GradientStop();

            stop.Offset = 0;

            stop.Color = Colors.Yellow;

            brush.GradientStops.Add(stop);

 

            stop = new GradientStop();

            stop.Offset = 0.2;

            stop.Color = Colors.Green;

            brush.GradientStops.Add(stop);

 

            stop = new GradientStop();

            stop.Offset = 1.2;

            stop.Color = Colors.Red;

            brush.GradientStops.Add(stop);

 

            grid1.Background = brush;

        }

Grid:

Windows Presentation Foundation (WPF).  3.   XAML.

. :

Windows Presentation Foundation (WPF).  3.   XAML.

:

Windows Presentation Foundation (WPF).  3.   XAML.

, . , , , . , .

, ( ):

<Button Content="" Height="23" HorizontalAlignment="Left" Margin="88,41,0,0" Name="MyButton" VerticalAlignment="Top" Width="75" Click="MyButton_Click" Foreground="{x:Static SystemColors.ActiveCaptionBrush}"></Button>

SystemColors.ActiveCaptionBrush. :

Windows Presentation Foundation (WPF).  3.   XAML.

:

MyButton.Foreground = SystemColors.ActiveCaptionBrush;

StaticExtension. x , XAML.

,  System.Windows.Markup.MarkupExtension. ProvideValue.

, . , , . WPF . , . , Grid ( ColumnDefinitions RowDefinitions):

Windows Presentation Foundation (WPF).  3.   XAML.

, :

Windows Presentation Foundation (WPF).  3.   XAML.

, :

Windows Presentation Foundation (WPF).  3.   XAML.

, , :

Windows Presentation Foundation (WPF).  3.   XAML.

, , , . , - , .

:

Windows Presentation Foundation (WPF).  3.   XAML.

, , :

        private void button1_Click(object sender, RoutedEventArgs e)

        {

            Grid.SetRow(button2, 0);

        }

button1:

Windows Presentation Foundation (WPF).  3.   XAML.

button2:

Windows Presentation Foundation (WPF).  3.   XAML.

button1, button2 :

Windows Presentation Foundation (WPF).  3.   XAML.

:

        private void button1_Click(object sender, RoutedEventArgs e)

        {

             button2.SetValue(Grid.RowProperty, 0);

        }

, .

 

 

( 07.02.2013 . )
 
« .   . »
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .