Click here to Skip to main content
15,502,332 members

Comments by Groulien (Top 52 by date)

Groulien 4-Mar-13 15:42pm View    
The real problem I'm facing is that a lot of events used to perform operations contain code like this:
previewProgressReport(openRepairJobs[(sender as ListBox).SelectedIndex]);

The new control can do more than the existing ListBoxes (internal reordering and more), that's the reason it's been requested.
I first tried to inherit from ListBox but that became an absolute mess because the items have child controls and the ListBox doesn't like irregular item heights.
Then I thought it might be better to go up the hierarchy (to ListControl) so that the ListBox logic wouldn't bother me.
We replaced all the (sender as ListBox) code with (sender as ListControl) to see if it harmed the existing code and it didn't.
The new control is derived from ListControl and is working quite well but the scrollbar is missing.
Groulien 4-Mar-13 15:09pm View    
I access data by using the SelectedIndex of either the ListBox or the new control but I don't want to have to check types all the time (Don't want to have to check which is being used).
Groulien 4-Mar-13 15:00pm View    
Current situation has a ListBox of which I use the SelectedIndex (defined by ListControl).
New situation allows the ListBox to be replaced (at runtime) by the new custom control of which I also want to use the SelectedIndex property.
(This new control does behave like a list)
By using the abstract class ListControl, I can switch the two more easily (at runtime).
If I use the ScrollableConrol then I can't refer to the same variable without having to check for its type.
Groulien 4-Mar-13 14:50pm View    
The control has to be exchangeable with the 'ordinary' ListBox (doing this through the parent class) so that users can get used to the new interface but, in case they're confused, can still switch back. All I really need is the SelectedIndex property which they would both share (and I don't like additional type checking for it).
Groulien 20-Feb-13 14:25pm View    
Even a simple form shows the issue.
It might not show on really powerful computers.
<window x:class="LagTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="LagTest" height="300" width="300">
<grid>
<richtextbox name="Rich" grid.column="0" grid.row="0" horizontalalignment="Stretch" verticalalignment="Stretch"></richtextbox>
</grid>
</window>