hi i want show image inside textbox i can do this with this codes, but As you can see in the image, the images should be on the left side and the text on the right so how i can do this? see this image
<Border Background="#f0f4f7">
<StackPanel Background="#f5f6fa" Margin="10,10,10,370">
<TextBlock Text="1397-1398"/>
<Border VerticalAlignment="Center" Background="#edf0f5" BorderThickness="5">
<StackPanel Background="#ffffff" Height="30">
<StackPanel HorizontalAlignment="Right" Background="#ffffff" Margin="5"
Orientation="Horizontal">
<Image Source="E:\Aks\ICON\colorful-stickers-icons-set\png\32x32\trash.png"
Height="18"/>
<Image Source="E:\Aks\ICON\colorful-stickers-icons-set\png\32x32\accept.png"
Height="18"/>
<TextBlock Foreground="#7c7f84" Text="یکسری اطلاعات برای نمایش در اینجا"
Margin="3 0 0 0"/>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</Border>
Using a Grid
with two columns will work:
<Border Background="#f0f4f7">
<StackPanel Background="#f5f6fa" Margin="10,10,10,0" VerticalAlignment="Top">
<TextBlock Text="1397-1398"/>
<Border Background="#edf0f5" BorderThickness="5">
<Grid Background="#ffffff" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Background="#ffffff" Margin="5" Orientation="Horizontal">
<Image Source="E:\Aks\ICON\colorful-stickers-icons-set\png\32x32\trash.png"
Height="18"/>
<Image Source="E:\Aks\ICON\colorful-stickers-icons-set\png\32x32\accept.png"
Height="18"/>
</StackPanel>
<TextBlock Foreground="#7c7f84" HorizontalAlignment="Right" Grid.Column="1" Text="یکسری اطلاعات برای نمایش در اینجا"
Margin="3 0 0 0"/>
</Grid>
</Border>
</StackPanel>
</Border>
Also, using VerticalAlignment=Center
on your border is unnecessary because it is contained within a StackPanel
.
You may also want to take a look at the documentation for right-to-left layouts: https://learn.microsoft.com/en-us/dotnet/framework/wpf/advanced/bidirectional-features-in-wpf-overview