سلام خدمت کاربران وب سایت پروگرم 98 😉 در این مطلب آموزش قرار دادن Image درون RadioButton با wpf و سی شارپ #C را آماده کردم. انشاالله که این کد براتون مفید باشه.
کد قرار دادن Image درون RadioButton با wpf و سی شارپ #C :
<Window x:Class="ControlDemos.RadioButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ControlDemos" Height="600" Width="500">
<Grid>
<StackPanel>
<RadioButton Click="HandleSelection" Name="r1">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" ></Image>
<TextBlock FontSize="24" Height="35" Width="150">A</TextBlock>
</StackPanel>
</RadioButton>
<RadioButton Click="HandleSelection" Name="r2">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" ></Image>
<TextBlock FontSize="24" Height="35" Width="150">B</TextBlock>
</StackPanel>
</RadioButton>
<RadioButton Click="HandleSelection" Name="r3">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" Height="200" Width="256"></Image>
<TextBlock FontSize="24" Height="35" Width="150">C</TextBlock>
</StackPanel>
</RadioButton>
</StackPanel>
<Menu Name="menu1" />
</Grid>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ControlDemos
{
public partial class RadioButton : Window
{
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ControlDemos" Height="600" Width="500">
<Grid>
<StackPanel>
<RadioButton Click="HandleSelection" Name="r1">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" ></Image>
<TextBlock FontSize="24" Height="35" Width="150">A</TextBlock>
</StackPanel>
</RadioButton>
<RadioButton Click="HandleSelection" Name="r2">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" ></Image>
<TextBlock FontSize="24" Height="35" Width="150">B</TextBlock>
</StackPanel>
</RadioButton>
<RadioButton Click="HandleSelection" Name="r3">
<StackPanel Orientation="Horizontal">
<Image Source="c:\image.jpg" Height="200" Width="256"></Image>
<TextBlock FontSize="24" Height="35" Width="150">C</TextBlock>
</StackPanel>
</RadioButton>
</StackPanel>
<Menu Name="menu1" />
</Grid>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ControlDemos
{
public partial class RadioButton : Window
{