|
Yes that worked. Thanks.
Sincerely,
-Ron
|
|
|
|
|
Hi,
I have created a listbox with items in XAML file using VS2008. (for a WPF Browser application)
I'm selecting a item with the mouse, and when I'm using the up and down keys of the keyboard and reach the top or the bottom of the listbox, it goes out the listbox.
Is there a way not to leave the listbox ?
I hope I'm clear enough in my explanation.
If anyone can help.
Thanks in advance,
Pat3d
My code:
<Page xmlns:my="clr-namespace:System.Windows.Shapes;assembly=PresentationFramework" x:Class="WpfBrowserStyleTest.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dropShadow="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
Title="Page1" Width="562" ShowsNavigationUI="False">
<Grid Height="263" Width="488">
<Grid.RowDefinitions>
<RowDefinition Height="176.346*" />
<RowDefinition Height="86.654*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="325.422*" />
<ColumnDefinition Width="162.578*" />
</Grid.ColumnDefinitions>
<dropShadow:SystemDropShadowChrome Color="#71000000" Margin="0,0,0,79.083" HorizontalAlignment="Left" Width="159.984">
<ListBox SelectionMode="Multiple" IsTabStop="False">
<ListBoxItem>test</ListBoxItem>
<ListBoxItem>test2</ListBoxItem>
<ListBoxItem>test3</ListBoxItem>
<ListBoxItem>test4</ListBoxItem>
<ListBoxItem>test</ListBoxItem>
<ListBoxItem>test2</ListBoxItem>
<ListBoxItem>test3</ListBoxItem>
<ListBoxItem>test4</ListBoxItem>
</ListBox>
</dropShadow:SystemDropShadowChrome>
<Button Grid.Column="1" Height="23" Margin="40.905,50.245,46.359,0" Name="button1" VerticalAlignment="Top">Button</Button>
</Grid>
</Page>
|
|
|
|
|
Try
<br />
<ListBox SelectionMode="Multiple" KeyboardNavigation.DirectionalNavigation="Cycle"><br />
Sincerely,
-Ron
|
|
|
|
|
Thanks Ron,
It's working fine with KeyboardNavigation.DirectionalNavigation="Cycle"
Pat
|
|
|
|
|
Hi everybody
I have a problem, for which, I don't seem to find the answer
I Created a User Control, in wpf. In that control I defined a Dependency Property as(all the smaller than signs are replaced with '[', and grater than signs are replaced with ']'):
public static DependencyProperty ItemsProperty = DependencyProperty.Register("Items", typeof(ObservableCollections[SomeClass]), typeof(MyUserControl), new PropertyMetadata(new ObservableCollection[SomeClass]);
I also implemented the standard Getter / Setter for that property as
public ObservableCollection[SomeClass] Items
{
get{return (ObservableCollection[SomeClass])GetValue(ItemsProperty)};
set{SetValue(ItemsProperty, value);}
}
In the constructor of the user control I subscribe to the CollectionChanged event as:
public MyUserControl()
{
InitializeComponent();
Item.CollectionChanged += new NotifyCollectionChangedEventHandler(items_CollectionChanged);
}
and in the event handler I have the code that does what is needed
private void items_CollectionCHanged(object sender, NotifyCollectionChangedEventArgs e)
{
//Build control foreach item in e.NewItems and add them to UI and remove from UI controls foreach item in e.OldItems
}
I add UserControls to my window as follows:
[StackPanel]
[local:MyUserControl]
[local:MyUserControl.Items]
[local:SomeClass .... /]
[local:SomeClass .... /]
[/local:MyUserControl.Items]
[/local:MyUserControl]
[local:MyUserControl]
[local:MyUserControl.Items]
[local:SomeClass .... /]
[local:SomeClass .... /]
[local:SomeClass .... /]
[local:MyUserControl.Items]
[local:MyUserControl]
[/StackPanel]
From the start everything worked fine, but if I add two or more instances of MyUserControl, to the window, the first instance is OK, but the other one contains also the items that was defined in the first one. For the example above one of the UserControls whould have 2 instances of control that is build in the CollectionChanged event handler, and the other one would have 5 of them. Does anybody know how to solve this problem. Any advice will be appriciated!
Uroš
<div class="ForumMod">modified on Monday, April 14, 2008 9:33 PM</div>
|
|
|
|
|
The problem is that the dependency property is static, therefore the default value only gets initialized once and the same collection is used for all the controls. In the dependency property use the default null and create the collection in the constructor.
See http://msdn2.microsoft.com/en-us/library/aa970563.aspx
|
|
|
|
|
Great. That solved my problem. Thanks
|
|
|
|
|
hi,
anybody know how to get the photo gallery using silver light
plz reply me...
Rajendran.AL
|
|
|
|
|
Hello,
Have you tried using this project[^]? It seems pretty nice..
There are a lot of samples in Silverlight Gallery[^]. You can probably find the sample that you want.
|
|
|
|
|
thanks alot.
Rajendran.AL
|
|
|
|
|
Hi All,
I want to use DataGridView which should be editable in my WPF application.
In Form Base application we can simply use DataGridView But here i am
unable to use it, what cade i have to written in XAML.
So Please any body suggest me what i have to do to use DataGridView in WPF.
Thanks
Bankey
|
|
|
|
|
Bankey,
You can download and use distribute for free, the datagrid controls from eXceed or Infragistics.
You can also write you own, depending on how much functionality you require.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Karl Shifflett wrote: You can also write you own, depending on how much functionality you require.
It's surprising that more people don't do this - considering how easy it is to extend and restyle controls like the ListView.
|
|
|
|
|
If you don't want to download something like the Infragistics or Exceed grids (and really you should look at them - they are very good), you could always host the WinForms DataGridView.
If you're running VS 2008, the steps to do this are:
1. Reference System.Windows.Forms and WindowsFormIntegration in your project.
2. Add a WindowsFormsHost element to your XAML and put the grid inside
:<WindowsFormsHost Height="100" Width="200">
<wf:DataGridView x:Name="dg" />
</WindowsFormsHost> 3. Add the following declaration to your XAML:
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
|
|
|
|
Pete,
I'll be off line starting tomorrow and will be back on line 28 April.
I'll try and gets of pictures. I didn't get any at MIX08 so I guess I should for this trip.
Cheers!!!
Karl
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Karl Shifflett wrote: I'll try and gets of pictures. I didn't get any at MIX08 so I guess I should for this trip.
Cool. I'll try to hold the fort here while you're away Enjoy your trip.
|
|
|
|
|
Pete O'Hanlon wrote: I'll try to hold the fort
When they starting piling up, remember the Alamo! Do leave you post!! LOL...
Josh & I have classes together over there will be a great time!
Thanks!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Karl Shifflett wrote: Josh & I have classes together over there will be a great time!
I'm jealous. I bet that's one hell of a time.
|
|
|
|
|
|
Hello,
I'm following Scott Guthrie's DIGG Silverlight tutorial as an introduction to Silverlight. I seem to have a problem debugging. When I run the solution, it works fine, but the process is not connected to the IDE. The break points aren't hit and I get a "no symbols loaded..." message. Any idea on why I can't step into the code behind?
Thanks!
Ian
|
|
|
|
|
- Open the application in VS.
- There will be two projects (SL and ASP.NET)
- Go to the properties of ASP.NET.
- Go to "Start Options"
- Check "Silverlight" in Debugger.
then, try to rebuild the application.
If it doesn't work, try to clear Temporary Internet Files. Actually, we don't need to clear those files but some said that this is a solution so you may try anyway.
|
|
|
|
|
Thanks for your reply!
As it turns out, the Silverlight debugger was turned on. I was using FireFox as the browser, so before I tried to delete the temp internet files, I decided to use Internet Explorer. Voila! It works! So I must have run into a bug regarding debugging a Silverlight project running in FireFox.
Thanks again!
Ian
|
|
|
|
|
Is is possible to use a Grid in the following situation:
<ListBox ItemsSource="{Binding ...}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Grid /> <!-- With necessary rows and columns -->
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<HierarchicalDataTemplate>
<TextBlock Text="{Binding Path=Text}" Grid.Row="{Binding Path=Row,Converter=...}" />
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
</ListBox> I've been trying the previous to no avail, the textblocks just won't sit in the appropriate row. I've got a feeling as to why this is happening but not how to solve it (note that using a UniformGrid without setting the rows and columns explicitly works).
Is it something to do with binding to an attached property?
|
|
|
|
|
Ed - sorry I haven't got round to looking at this before, but wouldn't a StackPanel with it's Orientation set to Horizontal do the job?
|
|
|
|
|
Nope, sorry. What I'm actually trying to do is create a schedule-like component (think Outlook week view). If you imagine the following class which stores the "Event information:
public class Event
{
public string Summary { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
} Then the following XAML:
<ListBox ItemsSource="{StaticResource Events}">
<ListBox.ItemTemplate>
<StackPanel
Grid.Row="{Binding Path=Start, Converter={StaticResource HourToRowConverter}}"
Grid.Column="{Binding Path=Start, Converter={StaticResource DayToColumnConverter}}"
Grid.RowSpan="{Binding Converter={StaticResource DurationToRowSpanConverter}}">
<TextBlock Text="{Binding Path=Summary}" />
<!-- Other stuff -->
</StackPanel>
</ListBox>
<ListBox.ItemsPanel>
<!-- Grid Goes here -->
</ListBox.ItemsPanel>
</ListBox> Hope that makes things a bit clearer, to be honest I was surprised when it didn't work but maybe it's something to do with the Grid.Row etc being an attached property? The UniformGrid works but I think that's something to do with the fact that you can just set the rows and columns and add children controls and they're each added to a cell in the order in which they appear in the XAML, whereas this does not happen with the normal Grid .
I'd really appreciate not having to go off and write a custom control just to manage what seemingly seems so simple.
|
|
|
|