|
D&D is so... well winforms, I think asp.net also had the D&D/ absolute position option, no one ever used it AFAIK. I suspect you are going to run into a large number of issues as your UI gets more complex. I mean more than you will with xaml.
As stated, styling is going to be easier with xaml.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I seem to recall hacking around with D&D for about an hour on my first WPF day - been typing XAML ever since. I suppose it is down to personal preference but at some point you are going to have to type some XAML so why not do it all the time?
|
|
|
|
|
Well my personal opinion will be to add controls by writing in the XAML rather than dragging from the toolbox. I have seen my Senior developer(who doesn't have much experience in WPF) adding controls in a Stackpanel by dragging into it!! Don't know how she did it, but then i corrected it by doing it in XAML.
Its better to use Grid.RowDefinitions and ColumnDefinitions as this is how Grid is meant to work, to add controls in Rows and Columns(here again the senior developers just dragged without using any Row or Column definitons!! ). Its much easier to handle the margins for your control, and styling the form will be much better and neater.
People with high attitude deserve the standing ovation of our highest finger!
My Technical Blog![ ^]
|
|
|
|
|
Don't do D&D ... create your XAML by hand, you'll get a better understanding of the syntax and you WILL experience less layout issues. Fact.
Toolbox is so last week ...
|
|
|
|
|
WPF TextBox - setting caret so hard! Following code doesn't change a thing!
(But works if I run the damn thing under Visual Studio debugger, stop working if I disable the breakpoints!)
<br />
<StackPanel Name="pnFreeTxt" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Visibility="Collapsed"><br />
<TextBox Name="SomeTextValues" Width="150px" GotFocus="SomeTextValues_GotFocus" PreviewMouseUp="SomeTextValues_PreviewMouseUp"></TextBox><br />
</StackPanel><br />
<br />
private void SomeTextValues_GotFocus(object sender, RoutedEventArgs e)<br />
{<br />
base.OnGotFocus(e);<br />
SomeTextValues.CaretIndex = FreeTextValues.Text.Length + 2;<br />
return;<br />
}<br />
<br />
private void SomeTextValues_PreviewMouseUp(object sender, MouseButtonEventArgs e)<br />
{<br />
SomeTextValues.CaretIndex = FreeTextValues.Text.Length + 2;<br />
SomeTextValues.ReleaseMouseCapture();<br />
e.Handled = true;<br />
return;<br />
}<br />
This doesn't help because I want caret set before user mouse down (auto focus on the textbox).[^]
Some guys are having similar issue with SomeTextBox.SelectAll()[^]
dev
modified on Friday, March 4, 2011 4:34 AM
|
|
|
|
|
1) Anyone know if it's possible to use MS Office themes to change the look of a WPF or Silverlight app at runtime?
2) Along those lines, anyone know wat format the MS Office Themes are in?
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
Kevin Marois wrote: 1) Anyone know if it's possible to use MS Office themes to change the look of a WPF or Silverlight app at runtime?
Not directly, no. But you can simulate them.
|
|
|
|
|
You'd have some legal issues using themes from office directly. Office isn't written in WPF anyways, so they wouldn't help you much. I'd suggest buying one of the many WPF UI libraries out there... they usually cost around $300 to $600 and all of them have all the Office theming / ribbon controls, etc. already done for you. You'd spend months / years duplicating that effort, so the $300 to $600 is well worth it .
|
|
|
|
|
This is the price i pay when i mixed silverlight and aspx pages in my application.
Good day guys, have some done this before ?
I want to redirect to a xaml page from a aspx page. i am using response.redirect.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
|
Thanks for your answer man, i think its too much work. I used the Deep path and its wonderful. So when i say deep path i mean you can access a xaml page fro aspx .net , it looks something like this
<br />
http:
that # is doing the work.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
|
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi I'm new here and also new to WPF. I'm an Electronics engineer and use C# for programming microcontrollers. On Windows I have some programming background in Delphi but that was about 8years ago.
Anyway I am working on a project now that requires a nice user interface for Windows so I am trying to learn WPF.
1.
The first problem is that I need a scrollable panel that can have up to 50,000 listboxes. I tested different controls and found that ListView is the best since it can virtualize. Once the listboxes are created the application works just fine but creating all those listboxes is taking ages. Loading time is acceptable for about 5000 items then it starts to increase exponentially. Is there any way around this?
2.
I am trying another approach where I have only a set of 15 listboxes and store the data in an array. When the user clicks for the next item I need to move the data from one listbox to the other and load the last box with data from the array. The problem is that the listboxes are named listbox1,listbox2....listbox15 so I cant put the code in a loop. Is it possible to bind the listboxes to part of the array so they automatically show the correct data according to the index selected?
PS - The listboxes are representing 100ms timeframes for a total of about 1hr20mins.
|
|
|
|
|
Its been said millions of times and I'm sure you'll hate to hear it for the million and one-th time:
If you think your window needs 50,000 items in it, you are going down the wrong road and need to rethink your approach.
Think about it, how can a user possibily interact with 50,000 items effectively? Even 5000 is too much. Heck, even 500 is too much. Remember, the user has to actually be able to FIND what hes looking for.
If you have more then 100 items per level, you are approaching your UI design wrong.
|
|
|
|
|
Thanks for your answer.
Well using the ListView, once it is loaded it is quite easy to scroll through the whole list and to the desired item. The only problem with this approach is that it takes too much time to create all those items.
I have switched to approach 2 now which loads instantly and managed scrolling through the items sequentially. Will try to add a scrollbar or slider to move through the list faster. I am doing the binding from array to listboxes manually though.
Do you have an answer to question No 2?
|
|
|
|
|
Unfortunately, you are designing your UI as an electronics engineer (since you are one) and not as a user or a software engineer . Your second approach sounds like you are "paging" 15 items at a time. I think that will hurt performance and is even worse in terms of UI design . 50,000 / 15 = 3334 pages!! Do you think anybody will want to scroll through 3334 pages? .
You didn't explain what data you are trying to display, but from your only description ("time frames"), perhaps a clickable graph would be better?
Otherwise, if I were you, I would post a CLEAR description of what data you are trying to display and we can suggest a better UI design.
|
|
|
|
|
Ok here is what I am trying to achieve.
I have a programmable electronic system with many (200 up to 4000) IO points and I am designing the user interface for programming the system. The user has to select which IO to switch at each timeframe (100ms). Some timeframes may have just 1 IO while other can have many. Most of the timeframes will stay empty though. The total time is about 1hr 30mins.
I am designing the interface to show all timeframes (15 at a time) so that the user would not need to input the time too (to reduce errors). So all he has to do is to scroll to the required timeframe and input the IOs he wants to switch ON. Then move to the next required timeframe and so on.
I have added a FastForward and FastBackward buttons and now it is very easy to scroll to the required timeframe. But if you can think of a better approach you're welcome to suggest.
|
|
|
|
|
If I get you correctly, you have a fixed list of times from 0 through to 90 minutes in steps of 100ms.
Against each of those times the user can enter zero or more items from a selection of 4000 IO Identifiers.
Most simply I'd think a grid would be possible - although it would have to have 90 x 60 * 10 = 54,000 rows which (as another poster says) isn't very user-friendly but is doable.
In column 1 of the grid is the time. The rest of the columns can then contain the IO identifier.
Done.
The data behind the grid can then be as simple as a collection of TimeFrame objects each of which contains a collection of IO identifiers.
Personally, because you said the majority if time points will be empty, I would probably think about showing the entries in a tree view or something - maybe level one has 90 entries for each of the 90 minutes - highlight those with some entry in them, expand to show the 60 seconds, and expend them to show the 10 lots of 100ms
Against the individual 100ms entries you can either expand the tree to show a list of IOs or show the IO details themselves in a separate control.
My feeling is that you are using a list box to enter a list of strings representing each of the IOs - so you could certainly keep this paradigm if you wanted, and still use the tree view effectively as a time selector.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Nice idea about the treeview. The problem with the grid of 54,000 rows is that it takes a very long time to create the contols foreach column at startup.
With the tree view method it can create only the minutes (90) on startup and when the user wants to expand a minute, it creates the seconds (60) controls on the fly and same for the ms. Can you post some code about this method please?
I will not switch to this method right now since the method I am using with the virtual columns is working quite good. However this would be more userfriendly so surely consider it for the next version.
Now I am looking for a control for showing (not editing) the program. It should show the whole 90min on loading and the user could zoom in and out to show more detail. When a program is loaded, the timeline would be filled up with the IO points(small circles or similar). When the user presses the START button a line/bar should start moving syncronized with the PC clock with the ability to pause and continue. It should be something similar to adobe premiere / adobe audition timelines - well those are very fast and efficient so a similar control would be really great.
Since it is quite complex to build (well it seems so), does a similar control exist already made?
|
|
|
|
|
I haven't tried it (and my Dev machine is broken right now) but I'd think that a grid with 50000 rows wouldn't take too long to populate - what are these controls you are creating? Databind a grid to something with 50000 in the collection, and badang - you got your 50,000 rows surely?
I don't know of any control similar to the one you're talking about for viewing - but if you're going to be doing something like that wouldn't it make sense to use the same one for editing? Show the timeline, then click on a point to add an entry for an IO - right click an existing one for options to edit or remove?
two different interfaces complicates it for the user - and makes for twice the maintenance costs.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
The controls were Listboxes and I was creating them programatically not by binding. This was taking too much time. I dont know if binding would speed the process up since it still has to create the controls.
Ofcourse it makes more sense but for editing it needs to be fully zoomed in for precision while for viewing this is not important.
Anyway I am new to WPF and am still experimenting and trying new things. Will try to find the control I have in mind (or manage to build it) and then see if I can use it for both interfaces.
Anyidea how to go for building such a control/interface?
|
|
|
|
|
Moonwalker031 wrote: The controls were Listboxes and I was creating them programatically not by binding. This was taking too much time. I dont know if binding would speed the process up since it still has to create the controls.
If you use a grid, imagine it in excel
Column A is the time
Column B through Z are all the IOs started at that time.
So, if the user wants to set IO65 to start at 1 minute, they scroll to the 1 minute row (1 x 60 x 10 = 600) and type 65 into the next available cell in that row.
simple, no?
No controls to create, as the grid has done it for you.
Moonwalker031 wrote: for editing it needs to be fully zoomed in for precision while for viewing this is not important.
True - but you'd need to be able to zoom anyway, so what better way to choose your spot than pointing at the area and scrolling to zoom ?
Moonwalker031 wrote: Anyidea how to go for building such a control/interface?
No - none whatsoever. But WPF is the ideal tool. A quick search found this[^] which may be worth a look.
Also here[^]
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Thanks for the links. Will try them out and see if they work for me.
|
|
|
|
|
Hi,
I have a xaml window that contains two different stackpanels and only one stackpanel can be shown at the same time.
I use a Stackpanel Visibility="{Binding State,Converter={StaticResource StateVisibility}}" do determine which one to show and StateVisibility is declared as IValueConverter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture).
The problem is that after a sleep, this converter is not called, can I in the C# code force a call to this converter?
Regards
Olof
|
|
|
|