|
What is the difference between an orange?
I love riddles.
.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 need to get a book on Silverlight and read it.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Silverlight is another about-to-be-abandoned microsoft technology that we've all be coerced into developing for u ntil it's replace with something "better".
.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
|
|
|
|
|
Atleast you should have searched in Search engines first. Ok i got this[^] as first link in google search.
|
|
|
|
|
I define some style on some button.
The style supposed to change the button bitmap in 'mouse over'.
The problem is that there are two scenario with 4 different bitmap => that mean
Scenario 1: the original bitmap is B1 and in 'mouse over' it need to be change to B2
Scenario 2: the original bitmap is C1 and in 'mouse over' it need to be change to C2
Those two scenario need to be on same button.
In my implementation the original & 'mouse over' bitmaps are hard coded - and i don't now how to change it in the xaml.
I mean that i need some 'if' condition in the xaml that will know if I'm run on Scenario 1 or Scenario 2. . .
How can i do it ?
Thanks for any help.
|
|
|
|
|
This answer may be simplistic as I am only recent to Silverlight but:
XAML has no decision making capability, that all needs to be done in the code behind the View or the ViewModel. So you need a property that exposes the image for the control to bind to and you need an event where you can manage the value of the property. You know the event, now write a handler and a property.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks,
But is there a any option to look some variable value from the xaml ?
The last thing that i want to do is to change the bitmaps thru the code ....
|
|
|
|
|
Your bitmaps are either a resource or file so you are not changing them, you need to change which file is displayed due to some conditions, the interpreting of the conditions cannot live in the xaml, no processing! So I think you have little choice.
However I would not base a decision on this advice alone - I can't guarantee that I'm correct! Wait for some more feedback.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Lookup the ValueConverter object.
.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 am having an issue binding a command to a user control. My main window calls a workspace viewmodel that supplies data via observable collection to a datagrid in the workspace viewmodel. In this datagrid I put a button, but am having an issue figuring out how to bind a command to it.
The datagrid itemssource is an observable collection from a viewmodel. I have a command on that same view model that tells the datagrid what to do when a button field is pressed. I bound to that name but it isn't working because. I am guessing this is because the datagrid (Which is on a user control) is bound to the observable collection of data and the command is outside the scope of that collection.
So on what viewmodel do I put my command in order to execute it on my usercontrol and how to I reference it on my user control?
Sorry for the vagueness of it all, this is a bit difficult to explain.
Cheers, --EA
|
|
|
|
|
After reading your convoluted question I can sympathise completely.
I think, your ITEMSOURCE for the datagrid is the collection, your DATACONTEXT of the control is where the command should reside. This stuff is completely different from what I am used to!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you use datagrid and you want a command inside the datagrid, then you should define that command in the ObservableCollection item object.
eg, If you use ObservableCollection<Customer> as ItemsSource, define the command in Customer class.
|
|
|
|
|
I had considered that as well, but the class is an entity created by the entity framework directly from an SQL table and I thought that overriding that class to add a command would be a little bit more spaghetti than I wanted to deal with. Still, that seems to me like the best working solution. Thank you for the advice.
Cheers, --EA
|
|
|
|
|
One way I have found to solve this is to bind your command to the parent datasource in the xaml.
For e.g.
cmd:mycommand="{Binding ElementName=LayoutRoot, Path=DataContext.RevertClick}" .
LayoutRoot is what would be the main layout grid in the xaml (added by default)....but you could have used a different name.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Are the columns auto-generated?
|
|
|
|
|
Not auto generated. The answer was to reference the command on the viewmodel using relativesource - findancestor. Nice and easy.
Thanks for the help.
|
|
|
|
|
Sounds like you want:
- DockPanel
-- Toolbar (Docked to the top)
-- Progress Bar (Docked to the bottom)
-- Grid (No docking, so will take remaining space)
--- Column 0 (*-width, so takes up half)
---- Left panel
--- Column 1 (*-width)
---- Right panel
|
|
|
|
|
I have user control that i wrote.
this user control is appear on some Window ( host ) and the window size is dynamic.
I want to make the user control size to be also dynamic - and if the window host size is change ( grow / shrink ) then the user control also will change.
I try a lot of thinks - but the user control size is not changing ( also try to mark the user control as 'fill' and its not working. )
How to do it ?
Thanks
|
|
|
|
|
Things to check:
1) Does the container (The UserControl's parent) have its HorizontalContentAlignment and VerticalContentAlignment set to Stretch?
2) Does the UserControl have its HorizontalAlignment and VerticalAlignment set to Stretch?
3) Are you sure the UserControl isn't already stretching? Set its background to an obvious color. Maybe the stuff INSIDE your control isn't resizing.
|
|
|
|
|
Hi,
I have a query that returns a lot of records. What I have done to optimize the initial data bind when setting ItemsSource is to only show the first 100 records.
However, I allow users to gain access to the remaining records by indicating there are more records and if they press a button, all the records are bound to the DataGrid. This setting of ItemsSource takes 10-15 seconds.
I don't mind how long that takes, but I have a storyboard animation that I overlay to let the user know something is happening. This animation is fine whilst querying and binding 100 records (must be quick), but when binding 1000+ records, the animation doesn't run.
I'm presuming this is because the binding and the animation are on the UI dispatcher thread, but this is kind of defeating my ability to keep the user in the loop in what is going on.
Has anyone solved this issue, either by doing it right (am I doing something wrong?) or by doing it another way?
Thanks for any advice.
Simon
|
|
|
|
|
<code><pre>
Public WithEvents hyperLink As New Hyperlink()
~~~~~~~~~~~~~~~~~
For Each Lists As Status In Some.Status
TextBlock.Margin = New Thickness(4)
TextBlock.TextWrapping = TextWrapping.Wrap
hyperLink = New Hyperlink() With {.NavigateUri = New Uri("ok://" & Lists.Text)}
hyperLink.Inlines.Add("OK")
TextBlock.Inlines.Add(Lists.Text)
TextBlock.Inlines.Add(hyperLink)
Grid.SetColumn(TextBlock, 1)
Grid.SetRow(TextBlock, grdList.RowDefinitions.Count - 1)
grdList.Children.Add(TextBlock)
Next
Private Sub hyperLink_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles hyperLink.Click
MsgBox("Here I want to put a hyperlink address.")
End Sub
</pre></code>
The above code is the approximate.
Look at the relevant section in the code above hyperlink, add a hyperlink to the Grid can be found.
Yeah, but added to the first hypertext link event occurs.
Only first hyperlink.
What should I do all the hyperlinks that event occurs?
|
|
|
|
|
rus204 wrote: TextBlock.Margin = New Thickness(4)
I am not sure that I understand your question but when you run this loop, you only add the hyperlink to one textblock. So only the first event fires.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Is there a decent way?
TextBlock.Margin = New Thickness(4) is margin is too narrow to declare.
|
|
|
|
|
rus204 wrote:
Yeah, but added to the first hypertext link event occurs.
Only first hyperlink.
How do you attach hyperLink_Click to click event?
|
|
|
|
|
I was declared hyperlink as WithEvents.
So I can add a Click event.
|
|
|
|