|
There program looks nice. I'm not sure where to start. I hope some of the links I provided can get you going. Maybe there are other links on the Internet.
Probably your first task should be, understanding "how" to edit a video file. Write a program that allows adding text or images to a video file.
Once you know "how" editing process works, putting it in a TimeLine should be the easy part.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi all,
I am really new to WPF and I am trying to create a combo box that has the ability to display an ellipses character if the text is too long (for the selected item). Can anyone help?
<ComboBox Grid.Column="1" Grid.Row="1" IsEditable="False" Width="200">
<ComboBoxItem>Electronics, Game Systems, Cameras & Photo</ComboBoxItem>
<ComboBoxItem>Computers and Networking</ComboBoxItem>
<ComboBoxItem>Clothing, Shoes, and Accessories</ComboBoxItem>
<ComboBoxItem>Books, Music, Movies, DVDs, and Video Games</ComboBoxItem>
<ComboBoxItem IsSelected="True">All Other Categories</ComboBoxItem>
</ComboBox>
-Aaron
|
|
|
|
|
|
Hi Karl,
Thank you for the reply. I actually did see this article before posting. I could not get it to work. How do I set the DataTemplate for the combobox?
|
|
|
|
|
Here is a code snippet from one of my programs.
<ComboBox x:Name="cboBindingPath" SelectedValuePath="Name" VerticalAlignment="Top">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Cheers, Karl
» CodeProject 2008 MVP
My Blog | Mole's Home Page |
XAML Power Toys Home Page
Just a grain of sand on the worlds beaches.
-- modified 27-Feb-21 21:01pm.
|
|
|
|
|
hmm. I must have something wrong. My code is below. When I select the item that is longer than the width of the combobox it does not show the ellipsis characters. Any thing that you can see that I am doing wrong?
<ComboBox Grid.Column="1" Grid.Row="1" IsEditable="False" Width="200" x:Name="Category">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ElementName=Category, Path=SelectedItem}" TextTrimming="CharacterEllipsis"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBoxItem>Electronics, Game Systems, Cameras & Photo</ComboBoxItem>
<ComboBoxItem>Computers and Networking</ComboBoxItem>
<ComboBoxItem>Clothing, Shoes, and Accessories</ComboBoxItem>
<ComboBoxItem>Books, Music, Movies, DVDs, and Video Games</ComboBoxItem>
<ComboBoxItem IsSelected="True">All Other Categories</ComboBoxItem>
</ComboBox>
|
|
|
|
|
I see what you mean. I have a hack, but want to give you a better solution. I'm in the middle to posting a new version of XAML Power Toys, so I'll get back to this tomorrow night after work.
For now, move ahead, we'll get this.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks Karl, You Rock!
|
|
|
|
|
Aaron,
I've spent the entire weekend updating XAML Power Toys for Silverlight and just published it.
I'll hop on this Monday after work.
I'm just plain beat and brain is out of gas.
I need my creative gas tank full to give you a solution that is not hacky.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Perhaps you can use a valueconverter (erm.. somewhere)
|
|
|
|
|
Aaron,
I've spent and hour got it to work but it had an unexpected behavior.
So I'm retemplating the ComboBox to support this. I had to download Blend to do this. Should be another hour or so.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Below are two solutions. One when the ComboBox ItemSource is data bound. The second when the ComboBox items are added in-line.
You can thank Code Project MVP Josh Smith for this solution. He is the real, "Man" and Mr. WPF.
Josh's blog: http://joshsmithonwpf.wordpress.com/
<!-- Use this when data binding your items source-->
<ComboBox ItemsSource="{Binding}" Width="100" VerticalAlignment="Center">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{TemplateBinding Content}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Use this when adding items in-line to your ComboBox-->
<ComboBox Width="100" VerticalAlignment="Center" SelectedIndex="0">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{TemplateBinding Content}"
TextTrimming="CharacterEllipsis"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.Resources>
<ComboBoxItem>Greetings from the planet known as Earth</ComboBoxItem>
<ComboBoxItem>Thanks to Josh Smith for this tip!</ComboBoxItem>
</ComboBox>
Cheers, Karl
» CodeProject 2008 MVP
My Blog | Mole's Home Page |
XAML Power Toys Home Page
Just a grain of sand on the worlds beaches.
-- modified 27-Feb-21 21:01pm.
|
|
|
|
|
I was just checking up on your blog. Good stuff. I really appreciate your help with this. I had a little bit of both in my attempts, I just could never get the right "combo". Thanks again.
|
|
|
|
|
Anytime.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I face an error at my aspx page i.e. Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site.
Even I installed AjaxToolkit and ScriptManager Tool is in my ToolBox.
Pls Support
Gautam
|
|
|
|
|
Your post title tells you that this is the wrong forum. Try the ASP.NET forum instead.
|
|
|
|
|
You should post in the ASP.NET forum.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I haven't tried to embed a WinForm control in a WPF application until now, so I may not be doing this right. When I create the WindowsFormsHost and add the WinForm control (the TextEditorControl from SharpDevelop) I cannot programmatically assign the keyboard focus to the WinForm control.
First I tried using the Focus() method on the control itself and on its text area. I never see the cursor blinking and keyboard input is ignored.
Then I used interop to pull in the user32.dll function, SetFocus(HWND) which when called with the control's text area Handle makes the cursor blink in the control, but keyboard input is still ignored.
I created a subclass of WindowsFormsHost so that I could set some breakpoints on the various On*Focus methods. The only thing that I can see is that OnLostKeyboardFocus is called when I manually click on the text editor control, but the KeyboardFocusChangedEventArgs.NewFocus argument is null, which means the new control is not recognized by WPF. That makes perfect sense since the control receiving the keyboard focus is a WinForms control.
So, any thoughts? Has anyone ever encounter this problem before? I have been searching on Google for hours and have not come up with anything.
Thanks!
Paul
|
|
|
|
|
Here's a little more information:
If I create a subclass of WindowsFormsHost and override the OnKeyboardGotFocus method like this:
[DllImport( "user32.dll" )]
private static extern IntPtr SetFocus( IntPtr hWnd );
protected override void OnGotKeyboardFocus( KeyboardFocusChangedEventArgs e )
{
base.OnGotKeyboardFocus( e );
SetFocus( editor.ActiveTextAreaControl.TextArea.Handle );
}
I can direct the keyboard focus to the editor control, but the cursor never appears. If I override OnGotFocus in the same way, I can see the cursor blinking but the keyboard focus doesn't change. If I override both, I get the keyboard focus but no cursor.
Paul
|
|
|
|
|
If you can give me a small ready-to-run sample I might be able to help you. We have lots of Winforms/Wpf interaction and I remember that it was quite a challenge to get the focus right. You might want to try to set the focus to your element via a dispatcher like so:
Dispatcher.Invoke(new Action(() => Focus()), System.Windows.Threading.DispatcherPriority.Background);
this might also help:
http://geekswithblogs.net/rakker/archive/2007/07/27/114232.aspx[^]
|
|
|
|
|
Is there a control anywhere that is similar to the page that you see when you make a new message on this website?
|
|
|
|
|
Ummmm, is this WPF related at all?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I would like to bind the SelectedIndex property of ComboBox to a property that is defined in my class that extends the Window class. It is hard to explain what exactly I want, so I will try to explain it with a simple example:
here is my .xaml code:
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ComboBox Grid.Row="0" x:Name="cmbSource" SelectionChanged="cmbSource_SelectionChanged">
<ComboBox.Items>
<ComboBoxItem> 1 </ComboBoxItem>
<ComboBoxItem> 2 </ComboBoxItem>
</ComboBox.Items>
</ComboBox>
<ComboBox Grid.Row="1" x:Name="cmbDestination" SelectedIndex="{Binding ElementName=Item, Path=Index}"> <!-- this doesn't work -->
<ComboBox.Items>
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
</ComboBox.Items>
</ComboBox>
</Grid>
</Window>
and here is my code-behind code:
namespace WpfApplication3
{
public partial class Window1 : Window
{
private Test _item;
public Test Item
{
get{return this._item;}
set{this._item = value;}
}
public Window1()
{
InitializeComponent();
}
private void cmbSource_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Item = new Test(cmbSource.SelectedIndex);
}
}
public class Test
{
private int _index;
public int Index
{
get { return this._index; }
set { this._index = value; }
}
public Test(int index)
{
Index = index;
}
}
}
When I was tring to solve this problem, I extended my Window1 class so it implements INotifyPropertyChanged interface, than I extended the Test class the same way, but nothing works. I even tried to define the Item Property as a DependencyProperty, but that didn't work either. Any idea will be appreciated.
thanks
Uros
|
|
|
|
|
You need to change your "Binding ElementName=Item, Path=Index"
First, add a x:Name property to your Window.
Then change the ElementName to the Window.Name property value.
Then change the Path to Item.Index
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Yes that solved my problem. Thank you,
Uros
|
|
|
|