|
Hi,
i m new to this silverlight...Plz give any sample code for www.k12.com[^]..for menu pop up....using silverlight controls with mouse over the text is chnaging with links.
With Regards,
Thanks in advance.
Ch.Gayatri
|
|
|
|
|
Have you searched the internet for some samples?
I found one here - Reusable Silverlight 2 Popup Menu and I know there are plenty more.
If you want to make your popup look like any website, you need to write your own code for it.
My signature "sucks" today
|
|
|
|
|
yes i found but not exact wht i want
|
|
|
|
|
Hi
I know that we can add the Validator.ValidateProperty call inside the buisness object and decorate it as [Required] like as follows. Reference : http://blogs.msdn.com/b/nagasatish/archive/2009/03/22/datagrid-validation.aspx
[Required]
public string FirstName
{
get { return firstName; }
set
{
if (value != firstName)
{
Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "FirstName" });
firstName = value;
NotifyPropertyChanged("FirstName");
}
}
}
My problem with this approach is that auto generated classes do not contain any validation logic inside them. I am generating the classes from an xsd (XSD2Code utility) and have to use these DTOs because all layers are utilizing them.
Silverlight->WCF->Business layer->Data Access layer : All using common DTO classes
My questions are :
1. How can I incorporate validations for datagrid entry fields without adding them into plain classes?
2. Is there a way that I can add all these rules in xsd and have them written out inside classes?
Please advise. Thanks
AJ
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
Hello everyone,
I have the following peace of code in a WPF application.
System.Threading.ThreadStart threadstartdelegate = delegate()
{
for (int i = 0; i < 100; i++)
{
System.Threading.Thread.Sleep(1000);
OnlineClientListBoxItem item = new OnlineClientListBoxItem();
item.SetUserDetails(Name: "Client " + i.ToString(), Userid: i);
lstbOnlineClients.Dispatcher.Invoke(new Action<OnlineClientListBoxItem>((x) =>
{
lstbOnlineClients.Items.Add(x);
}), System.Windows.Threading.DispatcherPriority.Normal, item);
}
};
System.Threading.Thread mainThread = new System.Threading.Thread(threadstartdelegate);
mainThread.SetApartmentState(System.Threading.ApartmentState.STA);
mainThread.Start();
and at this part lstbOnlineClients.Items.Add(x); it is giving me the following error "The calling thread cannot access this object because a different thread owns it." can anyone help me because this is the method in which you can invoce a control's method from another thread. Any ideas?
Thank you in advance
|
|
|
|
|
This is the most general issue. You can access UI objects only from UI thread.
In WPF the UI thread is pointed using Dispatcher object. So you can replace the code
lstbOnlineClients.Items.Add(x);
with
this.Dispatcher.Invoke(DispatcherPriority.Normal, new System.Windows.Forms.MethodInvoker(delegate()<br />
{<br />
lstbOnlineClients.Items.Add(x);<br />
}));<br />
Dispatcher will invoke the code in the UI thread.
I hope this will help you.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
The OP already uses Dispather.Invoke.
|
|
|
|
|
Add a 'faked' item to a ListBox which serves as an "Add New Item" button.
The listbox is bound to an SQL database via Linq2Sq. I'd like to see sth like this:
- Apple
- Orange
- Banana
- (add a new fruit)
When users selects (add a new fruit), then it becomes an empty TextBox in which user can input data of a new item. On lost focus (or immediately, whatever), another "faked" item appears.
How can I achieve this?
Thanks
Greetings - Jacek
|
|
|
|
|
Add the PK of each item to the item's tag. Add the "(add a new fruit)" item with a tag of -1.
In the change, check for -1.
Everything makes sense in someone's mind
|
|
|
|
|
Do you mean that I should store the "(add a new fruit)" item in the DB? If then, how to prevent WPF from updating that row in the DB when user is actually overwriting it with a "mango" or whatever? Everything is done with data-binding, so I do not have much control, I do not add items manually...
Greetings - Jacek
|
|
|
|
|
No, return a dataset of items from the database. Then add a new row to the bottom that has the "(add a new fruit)" and -1 for a key.
Before update, remove the row.
Everything makes sense in someone's mind
|
|
|
|
|
Jacek - off the top of my head, I'd be tempted to use a CompositeCollection[^] in the ListBox ItemsSource . Inside this CompositeCollection , I'd have an observable collection of fruit, a separate entry for the (add a new fruit) and a separate entry for the textbox. The last two entries would be datatriggered so that only one was visible at a time (based on the logic of selecting to add a fruit). When you add a new fruit, the (add a new fruit) option moves down the list.
"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
|
|
|
|
|
I have created my story board using expression blend but when i run the control it will run only once.but i need continues animation pls let me know wht i am suppose to do???
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi
|
|
|
|
|
|
thanks it works...
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi
|
|
|
|
|
I have the following XAML (there's actually more, but I thought it wouldn't be helpful since it's all the same only for different columns):
<ListView x:Name="InnerListView"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
x:FieldModifier="public"
BorderBrush="Black" BorderThickness="1"
ItemsSource="{Binding}" >
<ListView.View>
<GridView>
<GridViewColumn Width="100" Header="Downloads" />
</GridView>
</ListView.View>
<ListView.ItemTemplate>
<DataTemplate>
<DockPanel >
<Grid DockPanel.Dock="Right" >
<Label Grid.Column="1" Content="{Binding Path=WpfDownloads}" />
</Grid>
and in the code, I'm setting the list views data context to the observable collection of objects I'm trying to display:
InnerListView.DataContext = myList;
However, when the listview is displayed, all of the columns show "Namespace.Object".
What am I doing wrong?
.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
|
|
|
|
|
Is the path absolutely correct? It looks like you should be looking at a subproperty here, e.g. WpfDownloads.DownloadName. Without seeing the underlying code, I can't comment any further.
"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
|
|
|
|
|
WpfDownloads is a property of the object (derived from INotifyPropertyChanged ) contained in the observable collection. The set part of the property is being called, but the get isn't.
.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
|
|
|
|
|
Yes, it's a property of the object, but what type is it? Is it a class in its own right? If so, you need to bind to a property in the instance of WpfDownloads (or you need to write a converter).
"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
|
|
|
|
|
Try this:
<ListView
x:Name="InnerListView"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
x:FieldModifier="public"
BorderBrush="Black"
BorderThickness="1"
ItemsSource="{Binding}">
<ListView.View>
<GridView>
<GridViewColumn Width="100" Header="Downloads">
<GridViewColumn.CellTemplate>
<DataTemplate>
<DockPanel>
<Grid DockPanel.Dock="Right" >
<Label Grid.Column="1" Content="{Binding Path=WpfDownloads}" />
</Grid>
</DockPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
|
|
|
|
|
Oh, and that Grid.Column="1" doesn't need to be there.
|
|
|
|
|
So why didn't you just edit your post
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Didn't feel like it. And thought it would be more obvious that I made a change if I replied to my own post. Would have been even more obvious if I replied to JSOP directly to notify him of my change (that way, he gets notified via email of the new post), but then I'd have to refer to my previous post and I didn't really want to deal with that.
|
|
|
|
|
Well, it actually is needed. I just didn't provide all of the xaml...
.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
|
|
|
|
|
That worked. Now all I have to do is get past some of the built-in inability that is the ListView (no built-in sorting, no ability to freeze column widths, no ability to set a column that grows to fill remaining space, etc).
.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
|
|
|
|