|
Hmmm. That's not great. I suspect the TreeView is consuming it for its own purposes then (e.g. opening/closing nodes).
|
|
|
|
|
I was able to trap the MouseLeftButtonDown and check MouseButtonEventArgs.ClickCount == 2. Good enough I suppose.
|
|
|
|
|
|
Pete O'Hanlon wrote: Ouch. I hate hacks.
And you work with MS technology. hic!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Don't see how it's that big of a hack anyways... if the treeview is eating the message, there isn't any other way .
|
|
|
|
|
POHs words were innacurate, I'd call it a work around, its what we do, every framework has shortcomings and it is up to us to work around them to achieve our requirements. Kludge is another valid description, something that works but you are not happy with the way it does it. Elegant on the other hand is what we aspire to!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Kludge is another valid description, something that works but you are not happy
with the way it does it
Or, to put it another way, a hack. So my words were accurate.
|
|
|
|
|
It's a hack, because you don't have any chance to deal with the message you want to. It's not a criticism of your code - just that you shouldn't have to do that. It's at odds with the templated nature of WPF because while you can restyle the UI, you can't restyle the behaviour of the interactions without having to work round it. So, it's a hack.
|
|
|
|
|
hello,
i'm working in wpf application
and using pages
i'm show this pages in frame control
all my page opening in this frame
my questions
how close a page and delete it in navigation from frame
how clear my pages from frame control
Greeting
sayed eltokhy
hello every body
i'm sayed from in egypt
i like vb.net
|
|
|
|
|
I apologise if I haven't quite understood your requirements here, but are you trying to remove the journal entry? If so, you can use NavigationService.RemoveBackEntry to remove a page from the navigation journal.
|
|
|
|
|
I'm finally getting around to trying to learn WPF anyone know of a good resource site to start learning from?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Try here
Lists the blogs of the masters of WPF....sort of... and a couple of CPians that I don't know why are there.....
You know I'm kidding: Pete and Sacha
"Whether you think you can, or you think you can't--either way, you are right." — Henry Ford
"When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007
|
|
|
|
|
Soulus83 wrote: a couple of CPians that I don't know why are there
I have compromising photos of Josh Smith using an iPad.
|
|
|
|
|
If you're already comfortable in .NET programming (C# or VB) then I would (and did) read through the entire SDK documentation. Then do it again.
Windows Presentation Foundation[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm working on a new project, so I'm going w/ MVVM from the ground up... trying to stick to 100% "proper" MVVM and deleting the code behinds (and the subsequent InitializeComponent() call)... seems like this works fine for windows & dialogs, but seems to be an issue for a UserControl. Is it possible to have a UserControl without calling InitializeComponent()? I have an attached property on the usercontrol.xaml for the viewlocator, but even that is not getting called.
|
|
|
|
|
SledgeHammer01 wrote: trying to stick to 100% "proper" MVVM and deleting the code behinds
That's not a requirement of MVVM, and nor should it be. InitializeComponent is a very important method call.
I don't know where this zero-code-behind idea comes from. All MVVM requires is that you don't put model code in the code-behind. It's still acceptable to have a code behind, where you might want to trigger an animation for instance.
|
|
|
|
|
Well, kind of silly to have two code files if you don't need to . I mean, having view.xaml, view.xaml.cs, viewmodel.cs. I realize view.xaml.cs != viewmodel.cs (by theory only), but it seems silly to have it just for a constructor & initalizecomponent or to split code across two files.
I was trying to play around with an attached behavior to do this, but it seems like InitializeComponent() is not even a real function, its just generated in the g.cs file (sometimes) and the URI for the view is hard coded
P.S. Microsoft triggers animations via bool DependenyProperties. They don't even use StoryBoards. That seems pretty weird all the control animations are done via code.
|
|
|
|
|
Well, the idea, IIRC, is to have separated logic for Presentation(View) and Logic (ViewModel), so you can easily test Logic without having to simulate user clicks....that's only one of the main benefits...
Also, it's easily to port your ViewModel-Model to another View( ASP.Net MVC, a WCF service, etc) as you'll only refactor the view part.
If you think you're building something simple, then use the usual way, having code on the view and that stuff, I mean, MVVM is there to help, not to bloat your projects, just use what fits your needs
"Whether you think you can, or you think you can't--either way, you are right." — Henry Ford
"When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007
|
|
|
|
|
Yeah, I got it working an attached property that calls InitializeComponent() for me. That lets me avoid the dummy (at this point) code behind. My new project is kind of cool as I have all sorts of time to experiment with stuff like this . Gotta love no deadlines.
|
|
|
|
|
Remember that your .xaml.cs class is a partial class. The .g.cs class is the other half of the partial class, and it's generated to hook into baml - hence, it's kind of important to have the InitializeComponent in there.
|
|
|
|
|
SledgeHammer01 wrote: InitializeComponent
This needs to be called. SO you wont be able to remove 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.
|
|
|
|
|
hello guys... I have three tabs on which some of the GUI is same. So when I was done with tab1, I simple copied the some of the code in tab2, but off course changing some of the values and thier coordinates. But this act shows me above mentioned exception? Here is some of the code I copied.
<groupbox:GroupBox Header="Batch Details" Height="120" Width="430" Margin="0,10,800,0" >
<StackPanel>
<sdk:Label Height="28" Name="lblBatch" Width="50" Content="Batch Id:" Margin="-75,0,300,0"/>
<TextBox Height="20" Width="90" Margin="-130,-30,100,0" Name="txtBatch"></TextBox>
<sdk:Label Height="28" Name="lblCreatedBy" Width="65" Content="Created By:" Margin="-70,-30,0,0" />
<TextBox Height="20" Width="120" Margin="117,-30,0,0" Name="txtCreatedBy"></TextBox>
<TextBlock Height="20" Width="75" Margin="320,-27,0,0" Name="txtblkDate" Foreground="Blue">2011-05-12</TextBlock>
<sdk:Label Name="lblOperator" Height="28" Width="55" Margin="-365,0,0,0" Content="Operator:"></sdk:Label>
<TextBox Height="20" Width="100" Margin="-210,-25,0,0" Name="txtOperatorVal" IsReadOnly="True"></TextBox>
<TextBox Height="20" Width="240" Margin="140,-25,0,0" Name="txtOperatorVal2" IsReadOnly="True"></TextBox>
<sdk:Label Content="Approval: " Height="28" Width="55" Margin="-360,0,0,0"></sdk:Label>
<TextBox Height="20" Width="240" Margin="-65,-25,0,0" Name="txtApproval" IsReadOnly="True"></TextBox>
<TextBox Height="20" Width="100" Margin="285,-25,0,0" Name="txtApproval2" IsReadOnly="True"></TextBox>
</StackPanel>
</groupbox:GroupBox>
<groupbox:GroupBox Header="Batch Details " Height="120" Width="430" Margin="0,10,800,0">
<StackPanel>
<sdk:Label Height="28" Name="lblBatchOpr" Width="50" Content="Batch Id:" Margin="-75,0,300,0"/>
<TextBox Height="20" Width="90" Margin="-130,-30,100,0" Name="txtBatchOpr"></TextBox>
<sdk:Label Height="28" Name="lblCreatedByOpr" Width="65" Content="Created By:" Margin="-70,-30,0,0" />
<TextBox Height="20" Width="120" Margin="117,-30,0,0" Name="txtCreatedByOpr"></TextBox>
<TextBlock Height="20" Width="75" Margin="320,-27,0,0" Name="txtblkDateOpr" Foreground="Blue">2011-05-12</TextBlock>
<sdk:Label Name="lblOperatorOpr" Height="28" Width="55" Margin="-365,0,0,0" Content="Operator:"></sdk:Label>
<TextBox Height="20" Width="100" Margin="-210,-25,0,0" Name="txtOperatorValOpr" IsReadOnly="True"></TextBox>
<TextBox Height="20" Width="240" Margin="140,-25,0,0" Name="txtOperatorVal2Opr" IsReadOnly="True"></TextBox>
<sdk:Label Content="Approval: " Height="28" Width="55" Margin="-360,0,0,0"></sdk:Label>
<TextBox Height="20" Width="240" Margin="-65,-25,0,0" Name="txtApprovalOpr" IsReadOnly="True"></TextBox>
<TextBox Height="20" Width="100" Margin="285,-25,0,0" Name="txtApproval2Opr" IsReadOnly="True"></TextBox>
</StackPanel>
</groupbox:GroupBox>
So on tab2, it shows me a NullReferenceException thrown on GroupBox. Whats wrong? thnx
|
|
|
|
|
No idea with that wall of text lol. Two ways to go about fixing it: 1) turn on first chance exceptions and see if you get any further info 2) delete tab2 and add the controls back one by one til you see which one is throwing.
|
|
|
|
|
I would assume that the null reference is actually being thrown by one of the fields you are using to fill the TextBox es.
|
|
|
|
|
Hi,
trying to create a custom control derived from DataGrid.
At this point I want to have the same fuctionalaty as DataGrid.
I created A Custom Control derived from DataGrid:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ZivControls
{
public class ZivGrid : DataGrid
{
static ZivGrid()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZivGrid), new FrameworkPropertyMetadata(typeof(ZivGrid)));
}
}
}
Can someone please write the Generic.xaml so that the new custom control will have the same fuctionalaty as DataGrid (improving the control is my next step).
Thanks
Nitsan
|
|
|
|
|