|
hello
I've a WPF Popup which is positioned to upper left corner of a grid cell (This is done from OnCellChanged event) - problem is, when main window moves, the popup doesn't move along automatically.
Not much idea on how to "Anchor" the popup to the cell... any suggestion?
dev
|
|
|
|
|
A nasty (but possibly only) solution would be to move (translate) the popup as the main window moves. That should give you the 'anchoring' effect.
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.
|
|
|
|
|
You could set up an appropriate dependency property that is bound to the upper/left corener of the desired cell, and then the window would (or should) move accordingly.
.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 - I thought of routed event+dependency property. But not familiar enough to wire things up. I think following is my problem.
From my page's xaml.cs, I launched the popup everytime grid cell's content changes...
private void CntPropGrid_CellChanged(object sender, CellChangedEventArgs e)
{
...
SomePopup.IsOpen = true;
GeneralTransform transform = e.Editor.TransformToAncestor(CntPropGrid);
Point rootPoint = transform.Transform(new Point(0, 0));
SomePopup.PlacementRectangle = new Rect(rootPoint, new Size(200, 25));
SomePopup.Visibility = Visibility.Visible;
SomePopup.Width = 210;
SomePopup.Height = 30;
Result = SomeDialog.ShowHandlerDialog(e.Cell.Value.ToString());
SomePopup.IsOpen = false;
SomePopup.Visibility = Visibility.Collapsed;
SomePopup.Width = 1;
SomePopup.Height = 1;
SomeEditPlacementRect = CellEditPopup.PlacementRectangle;
...
}
I've now added dependency property, and corresponding CLR property wrapper:
public static DependencyProperty SomeEditPlacementRectProperty;
public Rect SomeEditPlacementRect
{
get
{
return (Rect)GetValue(ConstraintSettings.SomeEditPlacementRectProperty);
}
set
{
SetValue(ConstraintSettings.SomeEditPlacementRectProperty, value);
}
}
What I'm unsure of, is how to modify my xaml to wire up the separate parts ... so when grid cell location moves, popup changes accordingly.
<Popup
Name="SomeEditPopup"
Placement="Relative"
PlacementTarget="{Binding ElementName=SomeEntityGrid}"
IsOpen="False"
StaysOpen="true"
AllowsTransparency="True"
Visibility="Collapsed"
>
<StackPanel>
<myns:SomeUserControl x:Name="SomeDialog" ></myns:SomeUserControl>
</StackPanel>
</Popup>
First off, what "event" should I be using...? It's definitely not "MouseOver" on grid cell's parent data grid (as mouse over gets triggered all the time and does not equal parent window getting moved around). But in any case, final xaml should use routed event which resembles following?
<Popup
Name="SomeEditPopup"
Placement="Relative"
PlacementTarget="{Binding ElementName=SomeEntityGrid}"
IsOpen="False"
StaysOpen="true"
AllowsTransparency="True"
Visibility="Collapsed"
>
<Style.Triggers>
<Trigger Property="(QUESTION 1) $WHATEVENT$" Value="True">
<Setter Property="PlacementTarget" Value="(QUESTION 2) $WHATTOPUTHERE$" />
</Trigger>
</Style.Triggers>
<StackPanel>
<myns:SomeUserControl x:Name="SomeDialog" ></myns:SomeUserControl>
</StackPanel>
</Popup>
REF: WPF Concepts - routed events[^]
dev
|
|
|
|
|
hi... everybody sorry for my stupid question..
i've three options for creating the reports
1)crystal reports for asp.net application using crystal report viewer or silverlite application using silverlite report viewer..
2)ssrs reports for asp.net application using microsoft report viewer or silverlite application using silverlite report viewer..
3)report sharp shooter for asp.net application using report manager preview or silverlite application using report manager..
i'm really confused which one to choose..
the main requirment for me is the report should be fast accessible in server as our application is big..
the report should be fast viewed and take the print at the client side... and also load should be less at serverside..
please can anybody help me which one to prefer...
|
|
|
|
|
From you post I assume you are building a Silverlight app, AFAIK there is only 1 silverlight report viewer for SSRS and it is $500.
Crystal Reports has the worst reputation of any reporting tool that I know of, IMHO it is thoroughly justified it is a complete POS.
I have no experience with Sharpshooter.
We user SSRS in it's full server configuration, IE the reports are completely separate from the application(s) and reports are published to the SSRS server, security is handled by the SSRS interface.
I have also embedded SSRS reports into a personal app in Silverlight and the app calls an ASPX page with the embedded viewer. I cannot justify $500 for 2 reports
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Silverlight at the moment does not support crystal reports or ssrs.
So if you want intense reporting support (ssrs) you have no choice but to go for Asp.Net.
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.
|
|
|
|
|
I have a sample project with the a WPFL ListView:
<ListView ItemsSource="{Binding Source={StaticResource myIntCollection}}" />
and a Int32Collection resource myIntCollection is filled with duplicate items:
myIntCollection.Add(0);
myIntCollection.Add(1);
myIntCollection.Add(2);
myIntCollection.Add(0);
myIntCollection.Add(2);
myIntCollection.Add(3);
When testing it and clicking one of the 0's or one of the 2's the listview will actully select the other 0 or 2 than the one I really intended on selecting...
The focus logic in the listview works without a problem just the item selection is a problem. Moving the focus bounding box up and down the listview placing the focus at (zero based)item 3 can select item 0;
In my actual expanded project once this is solved, I do need to be able to display duplicate items in a list so the user can say change item 3 to value of 3 and be able to select either 3's correctly...
Anyone run up against this problem or are there a fix to this?
|
|
|
|
|
Grid Children are added to the bottom like this:
First
Second
Third
Fourth
...
BTW, Children do add upside down like this?
Fourth
Third
Second
First
|
|
|
|
|
Ok you have made 3 statements, do you have a question/problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ok. First, this is my code.(TextBlock add to the Grid)
for (int i = 0; i < 10; i++)
{
TextBlock TextBlock = new TextBlock();
TextBlock.Inlines.Add(i);
Grid.SetColumn(TextBlock, 1);
Grid.SetRow(TextBlock, Grid1.RowDefinitions.Count - 1);
Grid1.Children.Add(TextBlock);
}
And the result is
1
2
3
4
5
...
But, I want TextBlock add to the reverse order.
...
5
4
3
2
1
How can do this?
|
|
|
|
|
Try this
for (int i = 10; i > 0; i--)
Reverse the order that you traverse the numbers
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Uh.. that code is just sample.
Inline content in the TextBlock, the other goes.
|
|
|
|
|
Change the way you are viewing the problem. Assume that you will bind to the data, and then use a CollectionViewSource to manipulate the way you view the data - it's very easy to sort the data in the view without having to change it's underlying order in any way.
|
|
|
|
|
Have a look at the Grid.SetRow method[^].
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.
|
|
|
|
|
OK. I saw that article.
but.. I don't know in detail.
I have attempted below whatnot.
Grid.SetRow(TextBlock, Grid1.RowDefinitions.Count + 1);
or Grid.SetRow(TextBlock, Grid1.RowDefinitions.Count + 2);
but this isn`t work..
|
|
|
|
|
Try TextBox.SetRow() ; (if such a method shows up, I have not tried this before but it might be worth a try).
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.
|
|
|
|
|
Im converting a project from C# to VB (I know - I'm in HELL). I have a base class derived from UserControl , and have several controls derived from the base class. None of these objects are in their own namespace.
When I try to compile the app, I get the following error for all of the controls:
D:\dev\Silverlight\...\UserControls\MyControl.g.vb(41) : error BC30002: Type 'MyProject.MyBaseControl' is not defined.
The xaml looks like this:
<my:MyBaseObj x:Class="MyProject.MyControl"
xmlns:my="clr-namespace:MyProject">
The .vb code looks like this:
public partial class MyBaseObj
Inherits UserControl
end class
public partial class MyControl
Inherits MyBaseObj
end class
I tried creating a simple test project with a similar arrangement of files, and it compiles fine. I have no idea why it's doing this.
================ UPDATE:
When I try to define the xmlns namespace entry in the Xaml file, intellisense claims it can't find the namespace, even though I used intellisense to define the xmlns namespace entry. Because it can't find the namespace in the project, it doesn't show any objects when I try to define the user control itself (in 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
modified on Monday, November 22, 2010 9:44 AM
|
|
|
|
|
I must this inheritance looks a little convoluted.
MyControl inherits myBase and my:myBase is MyProject.MyControl.
Could that be creating some sort of cyclic reference.
Anyway, you could try a 'clean solution' - fixes things sometimes.
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.
modified on Saturday, November 20, 2010 8:28 AM
|
|
|
|
|
I don't think it's convoluted at all. All of the classes are in the same folder with no namespace declared. How can there be any circular references when the namespace is the same for all of the classes (except the root one, of course)?
MyControl --->MyBase --->UserControl
How is that convoluted (or even circular)? BTW, the actual source files compile fine - it's the .g.vb files that are not.
I *did* try a "clean solution" (and stated as much in my OP), and it compiles just fine. But when I try the same thing in my project, it doesn't compile with errors in the .g.vb files. The same code (in the original C# app) compiled just fine.
.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
|
|
|
|
|
FWIW I have has a similar issue that I couldn't see what was causing the problem. Eventually I gave up. next time I restarted VS2010 it just compiled fine!. never did find out why.
I'm guessing you already restarted VS, but thought it worth mentioning.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I actually rebooted the system. These are the only errors remaining in the project, and it's really pissing me off.
.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
|
|
|
|
|
Actually not specifically MVVM or even specifically WPF - but this is what I need help on...
I have a CustomerDetailsView and I have a CustomerDetailsViewModel
This view shows (obviously) a single customer's details.
I also want a list of customers that the user can search.
So - my initial thought was to have a collection of CustomerDetailsViewModels which I bind to something in a CustomerListView. so I have a CustomerListviewModel with a property of ObservableCollection<customerlistviewmodel>
but that strikes me as being wrong.
I really only want to show the customer first and surname in the list (let's say) - not the whole address, order values etc.
So my next thought was not to use a ViewModel collection at all, but just a collection of - What? customer models? Customer list models?
The ViewModel that 'displays' the list needs to be ignorant of the actual view - it just demands that there is a list of customers from which the user can select one, which will send a command back to the View model.
But because it doesn't know how this list is to be displayed, should it provide a collection of some ViewModel or other, each element injected into a view so I have a collection of views and associated view models that can then be shown in some sort of list?
Or do I provide a collection of data to which the grid (or whatever) binds?
I guess what the question boils down to is:
Is each element in a 'grid' displayed to the user a View with an associated ViewModel?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
My eyes crossed about 3/4 through that trying to keep track of the collections.
caveat - I am fairly fresh into the MVVM scene!
I would not consider having a collection of views or viewmodels. I only deal with collections of models. My models are based on database views that include all the FK descriptors that are required by the VIEW. Note only descriptors not any sub collections.
So I would have a collection of customer models (it may be a filtered collection based on the environment). In my VM base I have a static method that takes a shallow copy of the collection or object, this disconnects the new collection from the important collection and allows me to add defaults etc into the list. This is then used to populate combo controls. All are observablecollections
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: My eyes crossed about 3/4 through that trying to keep track of the collections.
yeah - sorry! In my defence, it was written last thing on friday before I left work.
Now it is later Friday and I am pissed - so I won't try.
I'm just checking out a couple of MVVM sites
This one is quite nice[^]
and listening to a hHanselminute blog
here[^]
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|