|
This is working perfectly well for me. What do you have in your styles?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Do you see the error? I did while I was posting this.
<Style x:Key="BorderStyle" TargetType="Border">
<Setter Property="CornerRadius" Value="O" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="SlateBlue" />
<Setter Property="BorderThickness" Value="2,0,2,2" />
<Setter Property="Width" Value="60" />
<Setter Property="Height" Value="30" />
<Setter Property="RenderTransformOrigin" Value="0.5, 0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="270"/>
<TranslateTransform/>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I do see a problem with the CornerRadius. It would be better if the error message was more helpful.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yeah - "catastrophic failure" ain't exactly intuitive.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Alright. I've been dickin' around with text rotation for two days, and I still don't get it. When I turn text 90 degrees i expected it to automatically adjust it's properties to essentially reflect it's original layout, only turn on its side. If I have a Label centered in a Border , and I rotate the Label , I have to dick around in Blend to get it to show up without being curt off, and without having to resize the container, and ll manner of other adjustments just to get the appearance I want.
I finally got tired of it last night, and I'm hoping someone answers this post before I get to work. Do I have to actually create a container (like a canvas) and put the text into the canvas to get what I want? What's the best way to do this?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
You are applying a transformation on the label, not the container, so any transformation you apply will have an effect only on the Label. If the container isn't big enough then the transformation will get cut off. You do need to transform the container instead.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello All
I am developing a website in which on the first page there is a section in which i want to change images automatically on the first page in silverlight.
I have searched a lot but could not find one..
Plese tell me a link to the tutorial
|
|
|
|
|
|
I'm trying to rotate a Label , and while the label is indeed rotating, the top/bottom of the text is cutoff. As you can see in the code posted below, I tried setting the width/height of the label, but that effected no visual change. What am I doing wrong?
<UserControl.Resources>
<Style x:Key="MidHeaderPanel" TargetType="Border">
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="2,0,0,2" />
<Setter Property="Width" Value="30" />
<Setter Property="Background" Value="SlateBlue" />
<Setter Property="CornerRadius" Value="0,0,0,0" />
</Style>
<Style x:Key="BaseNameHeaderText" TargetType="dataInput:Label">
<!--<Setter Property="Width" Value="60" />
<Setter Property="Height" Value="30" />-->
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="24" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="90" />
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" >
<Border Margin="10" CornerRadius="10" BorderThickness="2" BorderBrush="Black" Width="Auto" Height="Auto">
<controlsToolkit:DockPanel VerticalAlignment="Top">
<StackPanel x:Name="JellyBeanPanel" Height="100" HorizontalAlignment="Left" Background="Transparent">
<StackPanel x:Name="HeaderRow" Height="60" Orientation="Horizontal">
<Border Style="{StaticResource MidHeaderPanel}">
<dataInput:Label Style="{StaticResource BaseNameHeaderText}" Content="LUK" />
</Border>
</StackPanel>
</StackPanel>
</controlsToolkit:DockPanel>
</Border>
</Grid>
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Just remove
<Setter Property="HorizontalAlignment" Value="Center" /><br />
<br />
<Setter Property="VerticalAlignment" Value="Center" />
from your style and things should be fine.
*Edit*
You would also need to remove the hardcoded width
<Setter Property="Width" Value="30" />
from your first style.
*Edit*
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
That didn't work... :/
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: That didn't work... :/
Really weird.
I have used the following code (I even changed the text but then I had to increase the heights of the stackpanel to 160 each).
<UserControl.Resources>
<Style x:Key="MidHeaderPanel" TargetType="Border">
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="2,0,0,2" />
<Setter Property="Background" Value="SlateBlue" />
<Setter Property="CornerRadius" Value="0,0,0,0" />
</Style>
<Style x:Key="BaseNameHeaderText" TargetType="dataInput:Label">
<!--<Setter Property="Width" Value="60" /> <Setter Property="Height" Value="30" />-->
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="24" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="90" />
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" >
<Border Margin="10" CornerRadius="10" BorderThickness="2" BorderBrush="Black" Width="Auto" Height="Auto">
<controlsToolkit:DockPanel VerticalAlignment="Top">
<StackPanel x:Name="JellyBeanPanel" Height="160" HorizontalAlignment="Left" Background="Transparent">
<StackPanel x:Name="HeaderRow" Height="160" Orientation="Horizontal">
<Border Style="{StaticResource MidHeaderPanel}">
<dataInput:Label Style="{StaticResource BaseNameHeaderText}" Content="LUKjjkk" />
</Border>
</StackPanel>
</StackPanel>
</controlsToolkit:DockPanel>
</Border>
</Grid>
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
I neglected to remove the width property from the border style.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi,
I have the below XAML code :
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
WindowStartupLocation="CenterScreen"
Title="Window1" Height="300" Width="300">
<Grid>
<Image x:Name="TestImage" Source="{Binding Path=ImageSource}" />
</Grid>
</Window>
Now, I'm gonna set the `TestImage` with the below method :
Image Base64StringToImage(string base64ImageString)
{
try
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
IntPtr hBitmap = bmp.GetHbitmap();
System.Windows.Media.ImageSource imageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
Image wpfImage = new Image();
wpfImage.Source = imageSource;
wpfImage.Width = wpfImage.Height = 16;
return wpfImage;
}
catch
{
Image img1 = new Image();
img1.Source = new BitmapImage(new Uri(@"/passwordManager;component/images/TreeView/empty-bookmark.png", UriKind.Relative));
img1.Width = img1.Height = 16;
return img1;
}
}
I've used the following code, but it doesn't work :
public string ImageSource { get; set; }
ImageSource = Base64StringToImage("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABjUExURXK45////6fT8PX6/bTZ8onE643F7Pf7/pDH7PP5/dns+b7e9MPh9Xq86NHo947G7Hm76NTp+PL4/bHY8ojD67rc85bK7b3e9MTh9dLo97vd8/D3/Hy96Xe76Nfr+H+/6f///1bvXooAAAAhdFJOU///////////////////////////////////////////AJ/B0CEAAACHSURBVHjaXI/ZFoMgEEMzLCqg1q37Yv//KxvAlh7zMuQeyAS8d8I2z8PT/AMDShWQfCYJHL0FmlcXSQTGi7NNLSMwR2BQaXE1IfAguPFx5UQmeqwEHSfviz7w0BIMyU86khBDZ8DLfWHOGPJahe66MKe/fIupXKst1VXxW/VgT/3utz99BBgA4P0So6hyl+QAAAAASUVORK5CYIII").Source.ToString();
Actually , I have a problem with converting ImageSource to string !
Would you please guide me, how I can do it ?
Thanks.
|
|
|
|
|
This post here might be of some assistance to you.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Hi
I want to set the backgound of the DataGridRow based on the item which is displayed by that row. I use the DataGrid to diplay the people in the phone book. I want to set the background of the row based on the country in which that person lives. Does anyone knows how can I do that? Any advice will be appreciated.
Thanks in advance,
Uros
|
|
|
|
|
You could change the background color using a trigger as shown here.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Thank you for reply. That was excatly what I was looking for
Uros
|
|
|
|
|
Hello
I am confused how i have to use the setter and property tags in a ListView style.
I want a rounded border with the color red if i click on a item.
It would be nice if someone can show me a simple example.
thx
|
|
|
|
|
|
I found this post too and some others. But i can´t find a solution for my problem. I found an example which is almost i want.
The border in this solution is very "light" but i need a solid border. I tried alot but i didn´t hit the correct switches.
So can someone point me to the right way?
<Style x:Key="RedGlowItemContainer" TargetType="{x:Type ListViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border Background="Black" CornerRadius="4" BorderThickness="1" x:Name="IconBorder" Margin="1,1,1,1" >
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="IconBorder" Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
|
|
|
|
|
Check the documentation for the different properties of a Border control. Change the colour, increase the thickness etc.
It's time for a new signature.
|
|
|
|
|
Hi guys/Girls,
i am working in a project , where i need to show the hyperlink with some colors(i will change dynamically), but i need to remove the underline of the
hyperlink. Please help me peoples...
Thanks in advance..
yours
hema
|
|
|
|
|
Use stype for Hyperlink:
<Style TargetType="{x:Type Hyperlink}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="DarkSlateBlue" />
</Trigger>
</Style.Triggers>
<Setter Property="Foreground" Value="SteelBlue" />
<Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
</Style>
------------------------------
<TextBlock><Hyperlink NavigateUri="http://msdn.microsoft.com/library">Navigate to MSDN</Hyperlink></TextBlock>
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Hi Hema,
You can easily remove the underline from the hyperlink just set the property TextDecorations = "None" of hyperlink. And to change the color of hyperlink dynamically you can set the color in setter. I have used same in grid and working fine.
Hope the above will help you.
<Style x:Key="DataGridHyperlinkStyle" TargetType="{x:Type Hyperlink}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type WpfToolkit:DataGridRow}}, Path=IsSelected}" Value="true">
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
|
|
|
|