Jump to content
  • Advertisement

Side Winder

Member
  • Content Count

    279
  • Joined

  • Last visited

Community Reputation

174 Neutral

About Side Winder

  • Rank
    Member
  1. edit: I've now fixed this. The problem was that a new ViewModel was being created when the View was being created, so it would retrieve the values of the ViewModel just created, rather than the one in the list... I'm using MVVM to create a program with contacts and backed up messages to/from each contact. I have my MainView which contains a ListBox, and in this ListBox I want all of the contacts. I've read that you can set the DataTemplate of the ListBox to a user control (in my case ContactView). ContactView is fairly simple at the moment, but I will very likely expand on it later: <Border> <StackPanel DockPanel.Dock="Right" Orientation="Vertical"> <TextBlock Text="{Binding ContactFirstName}" FontWeight="Bold" Margin="5, 0, 5, 0"></TextBlock> <TextBlock Text="{Binding ContactLastName, diagnostics:PresentationTraceSources.TraceLevel=High}" FontWeight="Bold" Margin="5, 0, 5, 0"></TextBlock> <TextBlock Text="{Binding ContactNumber}" Margin="5, 0, 5, 0"></TextBlock> </StackPanel> </Border> The code in MainView for the ListBox is: <Border> <ListBox ItemsSource="{Binding Path=ContactList, Mode=TwoWay}" Grid.RowSpan="2"> <ListBox.ItemTemplate> <DataTemplate> <View:ContactView /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Border> I have correctly set the DataContext in the code-behind of the ContactView to ContactViewModel. I have also tried setting the DataContext in the XAML in MainView where I actually call the user control. So my problem is that nothing is showing visually. The binding expressions just aren't working. I found a website that gave some descriptions of debugging bindings, and I used a converter to check, and they came back null. I have also used tracing, which came back as follows: System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment') System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment') System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=ContactFirstName; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') System.Windows.Data Warning: 54 : Created BindingExpression (hash=11673710) for Binding (hash=38404320) System.Windows.Data Warning: 56 : Path: 'ContactLastName' System.Windows.Data Warning: 58 : BindingExpression (hash=11673710): Default mode resolved to OneWay System.Windows.Data Warning: 59 : BindingExpression (hash=11673710): Default update trigger resolved to PropertyChanged System.Windows.Data Warning: 60 : BindingExpression (hash=11673710): Attach to System.Windows.Controls.TextBlock.Text (hash=9400000) System.Windows.Data Warning: 65 : BindingExpression (hash=11673710): Resolving source System.Windows.Data Warning: 68 : BindingExpression (hash=11673710): Found data context element: TextBlock (hash=9400000) (OK) System.Windows.Data Warning: 69 : BindingExpression (hash=11673710): DataContext is null System.Windows.Data Warning: 63 : BindingExpression (hash=11673710): Resolve source deferred System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=ContactLastName; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=ContactNumber; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') System.Windows.Data Warning: 65 : BindingExpression (hash=11673710): Resolving source System.Windows.Data Warning: 68 : BindingExpression (hash=11673710): Found data context element: TextBlock (hash=9400000) (OK) System.Windows.Data Warning: 76 : BindingExpression (hash=11673710): Activate with root item ContactViewModel (hash=56738739) System.Windows.Data Warning: 106 : BindingExpression (hash=11673710): At level 0 - for ContactViewModel.ContactLastName found accessor RuntimePropertyInfo(ContactLastName) System.Windows.Data Warning: 102 : BindingExpression (hash=11673710): Replace item at level 0 with ContactViewModel (hash=56738739), using accessor RuntimePropertyInfo(ContactLastName) System.Windows.Data Warning: 99 : BindingExpression (hash=11673710): GetValue at level 0 from ContactViewModel (hash=56738739) using RuntimePropertyInfo(ContactLastName): <null> System.Windows.Data Warning: 78 : BindingExpression (hash=11673710): TransferValue - got raw value <null> System.Windows.Data Warning: 87 : BindingExpression (hash=11673710): TransferValue - using final value <null> Any ideas why this isn't working? Thanks. [Edited by - Side Winder on June 1, 2010 8:49:06 AM]
  2. Side Winder

    [.net] Properly implementing WPF flat buttons

    Can't you change the ControlTemplate to change this?
  3. Side Winder

    [.net] WPF tools.

    WinForms should still suffice for something really simple. WPF is great for more complex GUIs where you're using animation, or video combined with images, or something like that. It's also great because you can change the way controls look to the user, allowing you to create pretty much anything. There is definitely a learning curve with WPF, perhaps more so than WinForms, but once you start to get into it you start to understand how things work.
  4. Side Winder

    Warning on NN threads!

    Is there a problem with people trying things out for themselves? Surely you tried them once as well?
  5. Side Winder

    How can I speed up my face detection algorithm?

    Well I've implemented just the one pre-processing algorithm for skin implementation. I was thinking about putting in other algorithms in as well and ANDing them all, but decided against it. It's accurate enough for my needs, and it's cut the time taken from 80 seconds to about 8 seconds per photo. Of course, the more skin detected, the longer the neural network will take to go through all the regions. I used a YCbCr algorithm. Seems to be the most used on the internet from what I've seen. And yeah, I've seen something similar to that method before. The guy did 10 pixel steps and any "interesting" areas were re-scanned more thoroughly. And there was something to do with 30x30 windows.. I dunno, can't remember it too well, only skimmed it.
  6. Side Winder

    How can I speed up my face detection algorithm?

    Thanks guys. I found a skin segmentation algorithm that seems to work fairly well for what I want. It's cut the time taken per image by about 80%, and the false detections by quite a bit too!
  7. Let's say I'm using 20x20 windows. My initial image is 320x240. Even with steps of 2 pixels between each window that's something like 80,000 windows to scan. I'm using a pyramid of images with something like the next image is 80% of the previous one. In total it's going to be something along the lines of 200,000 windows to scan. This is a rather large number, and it takes about 80 seconds to scan one image with my dual core processor (it's multi-threaded, albeit probably not as well as it could be). So how can I speed this up? Obviously most of an image is going to be background clutter. Is there anything I can do to give parts of the image... values? So it'll skip the parts that are likely to be background? Or something to that effect? I'm aware that there are algorithms that can do this in real-time so it must be possible, but I have no idea HOW they do it. If it helps, I'm using neural networks.
  8. Side Winder

    [.net] [C#, WPF] Multi-threaded woes

    Works perfectly, thank you.
  9. I'm creating an application where I have many photos on display at once. My problem is loading them in a suitable manner. I want to have it in a similar way as Windows Explorer does. As in, when the user clicks on a folder/album the thumbnails will be loaded on a background thread, and as a photo gets loaded, the UI reflects the change. I only want this when the user SELECTS that folder though; so when they de-select a folder, the thumbnails that were loaded, will be... err.. un-loaded. Is that even possible? In my photo class I have a Source property that is of type ImageSource. The XAML uses this property. So what would be the best solution to this problem? I just tried using a BackgroundWorker but it says the object (I guess the photo object) belongs to a different thread so it can't change (i.e. load the thumbnail) the Source property. Thanks.
  10. I'm trying to implement steep parallax mapping and so far I've not been able to find any GLSL algorithms; only HLSL ones, and all of these use this particular function which isn't available in GLSL. I've done a search on these forums and came across this thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=404627 This post is a few years old so I'm hoping something has come about since then. Does anyone know if there's a solution? Thanks.
  11. Well, it works somewhat, but it doesn't "stick out" very much. There's definitely something happening because I can clearly see the light and shadows on the correct parts of the bricks (I'm using a wall texture). The fact that changing my scale factor doesn't do anything leads me to believe something's wrong. I looked at http://graphics.cs.brown.edu/games/SteepParallax/index.html that website for inspiration. I thought the value in the height/bump map determines how much that part extrudes? So surely changing the scale should've changed that? Very bizarre. Anyone have any ideas...? Thanks.
  12. Right... OK... How do I do that? :/ As in, how do I calculate the ModelViewMatrix to pass through? Cause that's actually what I'm trying to do in the first place (pass the MVM to the shader), but I was under the impression that I needed to calculate the MVM to pass it through.
  13. The error is invalid enum on glGetFloatv(). And then if I try glMatrixMode() I get an invalid operation... Thing is, looking at the SDK doc at opengl.org, invalid operation for glMatrixMode() is when it's being called between glBegin and glEnd... Except I'm using OpenGL 3.2... So I have no begin or end. And using glGetDoublev() didn't work either.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!