|
Just to make sure - your resources start with the <ResourceDictionary> tag right?
|
|
|
|
|
With what tag?
.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 found the answer (see OP).
.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
|
|
|
|
|
Thanks for posting the solution.
|
|
|
|
|
You could also take back what you said in the Lounge about Silverlight.
|
|
|
|
|
Never.
.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 All,
I am developing a WYSIWYG editor using Silverlight 4.0 RichText box. I am able to insert images in the RichText box editor, but not able to add shapes (Line, Eclipse, Rectangle etc.)
Can anyone provide me a pointer to do so?
Thanks.
____________________________________________________________
rishabhs
|
|
|
|
|
|
What have you tried so far?
Did you try
myrichTextBox.Selection.Insert(container);
where container is an layout control (say, a stackpanel) containing a shape.
|
|
|
|
|
Thanks Abhinav for your reply. I tried inserting a shape using UIControl.
My requirement is to add shapes like rectangle, ellipse with the same functionality (resize, backcolor, shadow etc) as provided by Word or Visio.
I will try the option suggested by you and will let you know.
Thanks.
____________________________________________________________
rishabhs
|
|
|
|
|
hi,
We are showing Video with slides(images) in silverlight .Our images come from amazon server now we want to cache these images before starting Video.
Any suggestion.
|
|
|
|
|
|
Hi,
I am a beginner in WPF and following Sams WPF in 24 hrs. There is an exercise to do a FontViewer application using grid which displays the list of system fonts and let the user choose any font and view the corresponding font applied on a sample text. I tried using a GRIDSPLITTER which is not resizing at all. Here is the code.
<Window x:Class="FontViewerGrid.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="500" Width="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="64*" />
<RowDefinition Height="310*" />
<RowDefinition Height="88*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="190.667*" />
<ColumnDefinition Width="387.333*" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Margin="6 5 6 5">
<TextBlock Text="Select a font from the list below. You can change the text by typing in the region at the bottom."
FontSize="14" TextWrapping="Wrap" VerticalAlignment="Top"/>
</Border>
<ListBox x:Name="FontList"
Grid.Row="1"
Grid.RowSpan="2"
ItemsSource="{x:Static Fonts.SystemFontFamilies}" Margin="6,5,6,5"/>
<GridSplitter Grid.Row="1" Grid.RowSpan="2"
Grid.Column="1"
Width="2"
Background="Gray"
ResizeDirection="Columns"
ResizeBehavior="PreviousAndNext" Margin="0,1,0,5" HorizontalAlignment="Left" />
<TextBox x:Name="SampleText"
Grid.Row="2"
Grid.Column="1"
MinLines="4"
Margin="6 5 6 5"
TextWrapping="Wrap"
ToolTip="Type here to change the preview text">
The quick brown fox jumps over the lazy dog.
</TextBox>
<GridSplitter Grid.Row="1"
Grid.Column="1"
Width="2"
Background="Gray"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Rows"/>
<StackPanel Grid.Row="1"
Grid.Column="1"
Margin="6 5 6 5">
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="10"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="16"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="24"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="32"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
</StackPanel>
</Grid>
</Window>
Please help me in spotting the mistake.
Thanks.
|
|
|
|
|
Put the grid splitter inside its own column:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="64*" />
<RowDefinition Height="310*" />
<RowDefinition Height="88*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="190.667*" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="387.333*" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Margin="6 5 6 5">
<TextBlock Text="Select a font from the list below. You can change the text by typing in the region at the bottom."
FontSize="14" TextWrapping="Wrap" VerticalAlignment="Top"/>
</Border>
<ListBox x:Name="FontList"
Grid.Row="1"
Grid.RowSpan="2"
ItemsSource="{x:Static Fonts.SystemFontFamilies}" Margin="6,5,6,5"/>
<GridSplitter Grid.Row="1" Grid.RowSpan="2" Grid.Column="1"
Width="2"
Background="Gray"
ResizeDirection="Columns"
ResizeBehavior="PreviousAndNext" Margin="0,1,0,5" HorizontalAlignment="Stretch" />
<TextBox x:Name="SampleText"
Grid.Row="2"
Grid.Column="2"
MinLines="4"
Margin="6 5 6 5"
TextWrapping="Wrap"
ToolTip="Type here to change the preview text">
The quick brown fox jumps over the lazy dog. </TextBox>
<GridSplitter Grid.Row="1"
Grid.Column="1"
Width="2"
Background="Gray"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Rows"/>
<StackPanel Grid.Row="1"
Grid.Column="2"
Margin="6 5 6 5">
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="10"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="16"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="24"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="32"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
</StackPanel>
</Grid>
|
|
|
|
|
Also, it looks like you had two splitters. I took one out. If you want a splitter for rows too, give that splitter it's own row. This shows just the column splitter:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="64*" />
<RowDefinition Height="310*" />
<RowDefinition Height="88*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="190.667*" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="387.333*" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Margin="6 5 6 5">
<TextBlock Text="Select a font from the list below. You can change the text by typing in the region at the bottom."
FontSize="14" TextWrapping="Wrap" VerticalAlignment="Top"/>
</Border>
<ListBox x:Name="FontList"
Grid.Row="1"
Grid.RowSpan="2"
ItemsSource="{x:Static Fonts.SystemFontFamilies}" Margin="6,5,6,5"/>
<TextBox x:Name="SampleText"
Grid.Row="2"
Grid.Column="2"
MinLines="4"
Margin="6 5 6 5"
TextWrapping="Wrap"
ToolTip="Type here to change the preview text">
The quick brown fox jumps over the lazy dog. </TextBox>
<GridSplitter Grid.Row="1"
Grid.Column="1"
Grid.RowSpan="2"
Width="2"
Background="Gray"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Columns"/>
<StackPanel Grid.Row="1"
Grid.Column="2"
Margin="6 5 6 5">
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="10"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="16"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="24"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
FontSize="32"
TextWrapping="Wrap"
Margin="0 0 0 4"/>
</StackPanel>
</Grid>
|
|
|
|
|
Got it. Thank you very much
|
|
|
|
|
I'm working with an established and growing commercial software development firm in Philadelphia. They are in need of a very strong C# WPF developer to join their Windows product development team. Agile/ TDD environment. Client is open to contract or full time. The position would be on-site in Philly. If you are interested in more info, I can be reached at ben.cadbury@modis.com. Thanks!
|
|
|
|
|
Please use the jobs forum.
It's time for a new signature.
|
|
|
|
|
Hello,
I want to have a Grid with zero "width" (alas you can't see it) being resized as an effect when I click enter in my program. (Kind of like this: http://www.bestbefore.ro[^] --> click on one of the links and see how the "lines" resize)
However, I have no clue as how to do it. No sample code whatsoever. I would like it to be done via code, or atleast be able to start the effect through code.
Here is my project and source code: http://www.sendspace.com/file/k2vus0[^]
I realize it's a kind of lame project name, but it's a school task. (And I'm not used to WPF, so the "I'm the expert" doesn't really apply :P)
Thanks,
Theo
|
|
|
|
|
What you want is a storyboard, which basically allows you to animate by transitioning a property from one value to another. For example, you can make a storyboard that transitions from the color red to the color blue, gradually. There is also the DoubleAnimation you can use in a storyboard, which allows you to transition from, say, the value 0 to the value 1.5, gradually. You'd want to use this DoubleAnimation storyboard to modify a width.
If you want to do more complex grid animations (e.g., by resizing specific columns), you're gonna want to read this article. In fact, you might want to start by reading that article. It gives a good introduction to storyboards and animations.
|
|
|
|
|
Hello,
Thanks for the links. However now I am stuck. This code doesn't do anything - my lines just keeps not being visible.
double left = horizontalLineContainer.Margin.Left;
double top = horizontalLineContainer.Margin.Top;
double right = horizontalLineContainer.Margin.Right;
double bottom = horizontalLineContainer.Margin.Bottom;
horizontalLineContainer.Margin = new Thickness(left, top, left, bottom);
ThicknessAnimation animation = new ThicknessAnimation();
animation.Duration = new TimeSpan(0, 0, 2);
animation.From = horizontalLineContainer.Margin;
animation.To = new Thickness(left, top, right, bottom);
Storyboard.SetTarget(animation, horizontalLineContainer);
Storyboard.SetTargetProperty(animation, new PropertyPath(Grid.MarginProperty));
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(animation);
storyboard.Begin();
Thanks,
Theo
|
|
|
|
|
OK, so I got it to display. It seems it does the animation, but it's extremely fast, no matter what TimeSpan I enter, be it 2 or 20000 seconds. Here's my code:
double left = horizontalLineContainer.Margin.Left;
double top = horizontalLineContainer.Margin.Top;
double right = horizontalLineContainer.Margin.Right;
double bottom = horizontalLineContainer.Margin.Bottom;
horizontalLineContainer.Margin = new Thickness(left, top, left, bottom);
horizontalLineContainer.Visibility = Visibility.Visible;
ThicknessAnimation animation = new ThicknessAnimation();
animation.Duration = new TimeSpan(0, 0, 20000);
animation.From = horizontalLineContainer.Margin;
animation.To = new Thickness(left, top, right, bottom);
Storyboard.SetTargetName(animation, horizontalLineContainer.Name);
Storyboard.SetTargetProperty(animation, new PropertyPath(Grid.MarginProperty));
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(animation);
storyboard.Begin(horizontalLineContainer);
NOTE: I would like to say that this is very urgent, as this is a school task due monday. Any help is appreciated.
Thanks,
Theo
|
|
|
|
|
I don't see how that works at all. The "From" and "To" are identical.
|
|
|
|
|
Hi Guys,
I've got a MyUserControl i have created for my app. When i click on, or mouse over the MyUserControl, i'd like the events to be raised with the MyUserControl as the OrigionalSource. As they are composite controls, made up of numerous other controls, i get whatever child control was clicked inside MyUserControl.
How do i go about achiving this?
Regards
Tristan
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
AFAIK, you can only get the control for which the event was fired.
Use the VisualTreeHelper's VisualTreeHelper.FindElementsInHostCoordinates method to get all control within the mouse position from where the event was fired.
|
|
|
|
|