|
I would first import everything into something more "friendly" and "common"; like generic Lists or Observable collections or a concurrent dictionary.
You're on the right path (and could "index" the rest), but converting your input stream makes things much more pleasant down stream.
You can do a lot of work in 3 seconds.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Take a look at Josh Smiths treeview articles, I use the treeview and treelistview extensively and use Josh's structure. Gerry is right that you should be putting the data into an object (livecameraresult) but I would then use the TreeNode to bind with the treeview.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Is there some magic that will allow me to control the visibility of a GroupBox . I have a visibility converter that works perfectly on a button but a GroupBox ignores it completely.
Combobox with 2 options, selected item drives and OPC property in the VM that changes a boolean OPC property that is bound to the GroupBox visibility. The event path works works, values change as expected, button visibility changes but the GroupBox stubbornly stays visible.
<GroupBox Header="Rate Type"
Visibility="{Binding IsPAssThrough, Converter={StaticResource VisibilityConverter}}">
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Visibility is an enum, and not a bool; as your XAML implies.
And I use all 3; so a binary converter is useless.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
The converter returns Collapsed or Visible, the only 2 states I need. The converter works perfectly for a command button but not for a groupbox, the issue is in the groupbox control.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It looks like it should work, assuming your converter is returning the correct values.
Are there any binding errors in the Visual Studio output window?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The VM grew too complex so instead I split it along the lines of the visibility requirement which is logical and happens to eliminate this issue nicely.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a wizard. When page 1 is reached I get a UserControl from a list of MEF plugins and add it to the page.
The UserControl has a DP called IsValid on it. I want to bind this property to a property on the VM called IsDatabaseValid
Here's what I have
private void NextExecuted()
{
CurrentPage = CurrentPage + 1;
DatabaseSelectorControl = null;
IDatabase control = null;
switch (CurrentPage)
{
case 0:
break;
case 1:
control = ((App)Application.Current).DatabaseService.DBPlugins
.Where(x => x is UserControl && x.DatabaseType == SelectedDatabaseType.DatabaseType).FirstOrDefault();
DatabaseSelectorControl = (DatabaseSelectorBase)control;
break;
}
if (DatabaseSelectorControl != null)
{
Binding binding = new Binding();
binding.Source = this;
binding.Path = new PropertyPath("IsDatabaseValid");
binding.Mode = BindingMode.TwoWay;
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
BindingOperations.SetBinding(???, DatabaseSelectorControl.IsValid, binding);
}
}
How do I create this binding?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
It should be as simple as:
BindingOperations.SetBinding(DatabaseSelectorControl, DatabaseSelectorControl.IsValidProperty, binding);
NB: Assuming DatabaseSelectorBase inherits from UserControl , you can simplify the LINQ statement that finds the control to:
DatabaseSelectorControl = ((App)Application.Current).DatabaseService.DBPlugins
.OfType<DatabaseSelectorBase>()
.FirstOrDefault(x => x.DatabaseType == SelectedDatabaseType.DatabaseType);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The only change I needed was this
BindingOperations.SetBinding(DatabaseSelectorControl, DatabaseSelectorControl.IsValidProperty, binding);
to this
BindingOperations.SetBinding(DatabaseSelectorControl, DatabaseSelectorBase.IsValidProperty, binding);
to this
"DatabaseSelectorBase" is the control where "DatabaseSelectorControl" is an instance.
Thansk for both tips. Worked great.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Your Path doesn't have a Fill.
This space for rent
|
|
|
|
|
Sorry, I figured it out
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
There was no need to delete your question. Now, anyone else who is facing a similar issue won't have the context.
This space for rent
|
|
|
|
|
I have more of a win forms background and while it is quiet at work thought I'd have a look at WPF.
Does anyone have a good place / reference that I could use for UI design?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Go to the WPF section in CodeProject articles, and look at all those by Sascha Barber; some really excellent materials.
|
|
|
|
|
I find Sasha's article to be over the top for an introduction to a subject. I'd look for an introductory article, one that concentrates on the MVVM concepts.
You also need to pick a framework to use, I use GalaSoft MVVM Light because it is a minimalist framework, but there are many other options out there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Mycroft.
it makes sense to look at an MVVM framework first, as I knew that this was a large part of the WPF concept that I would need to understand.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I am working on a tool that allows the user to design a piece of equipment. The designer will be very much like this
One important thing will be the ability of the user to design their own shapes. In the example I posted the shapes are pre-designed. But in this case the user would need to be able to free hand draw a shape that can then be dragged onto the design surface.
Any thoughts on how to do this?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
2D or 3D?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Sorry, 2D
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
For 2D, a "connect the dots" (see WPF "Path") method can help with free-hand drawing.
Or, you can use "small" shapes to create bigger shapes; usually using fractals.
Depends on how complicated the shapes are.
An Introduction to Fractals
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
modified 24-Aug-17 11:58am.
|
|
|
|
|
I guess the thing I would really want it to be able to detect when the user has clicked inside a custom drawn control.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
While my user controls may not have "click" events, they can respond to "preview mouse down" which "act" like click handlers or context menu popups (to the user).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Right, but how do you know if the user clicked inside the shape? If I had a user control, which is square or rectangular, and I draw a triangle or star on it, I would want to only handle the mouse down if it's actually inside the shape I've drawn.
I guess you could evaluate the current mouse position and see if it falls within the path, but that seems rather complex.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
My "shape" would be an "object", that you "shape"; not something I could "click through" in that case.
(If I didn't want to resort to "hit-point" calculations; and I don't).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|