|
Hi,
I am using WrapPanel with VirtualizationMode="Recycling" to hold a huge amount of UserControl (say about 2000). I have an ObservableCollection to hold data of those UserControls (approx 20 Properties each). I am binding that ObservableCollection to the WrapPanel, so that, if any data change happens from the back end, it will change the UI. This change happens after each second.
On Window_Load_Completed event, I am actually binding those UserControls with data to the UI. After that, I am just modifying the properties, no add / no delete. In that case, I observed that, CPU utilization is coming to almost 95% & my application becomes very slow. If I scroll the panel, it scrolls after approx 1-2 mint. I need to sort the collection too which will be worst in this case.
Please help me out. Let me know, how I can resolve this issue? Is there any alternative to that? Kindly provide some codes, if you have.
I am using WPF 3.5 SP1.
Thanks in advance.
Regards,
- K
|
|
|
|
|
microsoft_kc wrote: I am using WrapPanel with VirtualizationMode="Recycling"
WrapPanel has a VirtualizationMode property??
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, I am using that... & here is the XAML:
<WrapPanel VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"/>
modified on Friday, May 15, 2009 2:58 AM
|
|
|
|
|
Hi,
I have some problem withe multi binding in wpf:
1) In the widnow cs file, I define a property like this:
private ObservableCollection<string> colltest = new ObservableCollection<string>();
public ObservableCollection<string> Coll
{
get
{
return this.colltest;
}
}
2) In the xaml file define a multi binding to the "togglebutton".
<ToggleButton Tag="dd" Content="TT" Width="50" Height="50">
<ToggleButton.IsChecked>
<MultiBinding Mode="OneWay" Converter="{x:Static app:SimpleConverter.Instance}">
<Binding Mode="OneWay" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type app:Window1}}"
Path="Coll" />
<Binding Mode="OneWay" RelativeSource="{RelativeSource Mode=Self}" Path="Tag" />
</MultiBinding>
</ToggleButton.IsChecked>
</ToggleButton>
3) and the covnert function of the converter is like this:
public object Convert(object[] value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool bflag = false;
if (value[0] == DependencyProperty.UnsetValue || value[0] == null||
value[1] == DependencyProperty.UnsetValue ||
value[1] == null)
return bflag;
ObservableCollection<string> v1 = value[0] as ObservableCollection<string>;
string v2 = (string)value[1];
if (v1 != null)
{
bflag = v1.Contains(v2);
}
return bflag;
}
It's working after the window is loadded. But however, after I add some new string to the collection "colltest", the togglebutton's "IsChecked" is not updated automatically.
I want it working in this way: If any changes are made to the collection "colltest". The togglebutton's "IsChecked" could update accordingly.
So how to resolve this problem?
thanks.
|
|
|
|
|
Eric Vonjacson wrote: If any changes are made to the collection "colltest". The togglebutton's "IsChecked" could update accordingly.
What kind of changes?
ObservableCollection notifies about changes to the collection, but if you want
notifications on changes to items in the collection, you'll need to implement
INotifyPropertyChanged on those items (the item's class).
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
1) If it's a problem setting up the data binding, the error will NOT display like an exception, but will show up in the Output window. Open that up and watch for any messages. That should let you know if it's finding the binding source.
2) If that much is working, drop a breakpoint in your Convert routine, and step through to see if the flag is being updated properly.
|
|
|
|
|
XAMLFestOnline is a five day event hosted by msdev.com. It is delivered by both recorded sessions and over Live Meeting. Five sessions covers WPF, Silverlight and the Visual Studio and Expression tools. The sessions focus on real life line of business solutions.
In order to attend, attendees must register for each event. Recorded sessions will be available May 25. Live events are offered for designers in the morning (9 am Pacific, noon Eastern) and for developers (1 pm Pacific, 4 pm Eastern) in the afternoons the week of June 1. Just because you are a developer though, you can learn the designer tools and expand your skill set. Designers can learn what happens on the back end systems in the developer sessions. You’ll have access to proctors and question and answers during the live sessions.
Sign up for all sessions online. You’ll need to sign up for each session to participate. Once you register, you’ll have access to the source code that will give you a jump start on your next user interface project.
See XAMLFestOnline for complete description of the content for each session and to register.
|
|
|
|
|
XAMLFestOnline is a five day event hosted by msdev.com. It is delivered by both recorded sessions and over Live Meeting. Five sessions covers WPF, Silverlight and the Visual Studio and Expression tools. The sessions focus on real life line of business solutions.
In order to attend, attendees must register for each event. Recorded sessions will be available May 25. Live events are offered for designers in the morning (9 am Pacific, noon Eastern) and for developers (1 pm Pacific, 4 pm Eastern) in the afternoons the week of June 1. Just because you are a developer though, you can learn the designer tools and expand your skill set. Designers can learn what happens on the back end systems in the developer sessions. You’ll have access to proctors and question and answers during the live sessions.
Sign up for all sessions online. You’ll need to sign up for each session to participate. Once you register, you’ll have access to the source code that will give you a jump start on your next user interface project.
See XAMLFestOnline for complete description of the content for each session and to register.
|
|
|
|
|
Thanks for that post!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If they aren't gonna give us solutions to the buggy IDE that don't include the phrase "wait until VS2010 is released", I'm sure it'll be a complete waste of time. As often as VS2008 freezes up, I can keep a 5-gallon container of ice cream on my monitor and not worry about it going bad. And yeah - I have all the "hot fixes" (an ironic pseudonym for something that's suppose to fix the freezing problems). and no, I haven't bothered reporting these issues to Microsoft because I'm tired of seeing people that are reporting real bugs being told by MS that it's not a bug. I call "bullsh*t!"
brucedkyle wrote: Learn more about Microsoft emerging technologies
I don't want to learn about things like the puddle of afterbirth that is WPF. Pardon my cynicism, but WPF is obviously a half-assed attempt at a "technology", and the current tools from Microsoft, quite frankly, bite big hairy donkey penile glands.
For what it's worth, all you guys gotta do is release the real WPF and associated tools to the real developers out here, and we'd be generally happy. As it is now, WPF sucks.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What is the best (least troublesome) method for organizing your resource dictionaries without making them so large as to become unwieldy? The only way I can make mine usable is to make one giant file, which just pisses me off to no end.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Use merged dictionaries?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've been trying that, and I must be missing some fundamental skill. I have this:
In a separate assembly (a sub-project in the solution)
Styles.xaml
<Style x:Key="StyleUDPBaseButton" TargetType="{x:Type Button}" >
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.40" />
</Trigger>
</Style.Triggers>
</Style>
Buttons.xaml
<Style x:Key="ToolbarButtonNewServiceOrder" TargetType="{x:Type Button}"
BasedOn="{StaticResource StyleToolbarButtonEx}" >
<Setter Property="ToolTip" Value="Create a new service order" />
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Image Source="/CometResources;component/Images/GlassServiceOrder64.png" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
In the application assembly
Window1.xaml.cs
<Grid Name="gridToolbarObjects" MinHeight="41" MaxHeight="41">
<Button Name="buttonNewServiceOrder" Style="{DynamicResource ToolbarButtonNewServiceOrder}" />
</Grid>
App.XAML
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/CometResources;component/Styles.xaml" />
<ResourceDictionary Source="/CometResources;component/Buttons.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
I'm getting the ever-informative exception that states:
startIndex cannot be larger than length of string.<br />
Parameter name: startIndex
This tells me that it can't find one of the things in my string of derived styles. Actually, it doesn't give any indication of what's really wrong - I had to google it, but I digress.
What am I doing wrong, Obi-Wan? You're my only hope.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Looking at your markup here, it looks like you're using an external resource dictionary. Try using the following instead:
<ResourceDictionary Source="pack://application:,,,/CometResources;component/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/CometResources;component/Buttons.xaml"/>
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
No change... :/
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
You might find this[^] a useful resource.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yeah, I already found that - comment: Big deal MS - the "fix" is coming in VS2010. In the meantime, I'm f*cked because we don't use tools here that are purposely labeled "beta"...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I know this is no consolation to you, but I use Blend precisely to get round issues like this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Blend. BAH! Blend is for people that are tired of complaining about the IDE and the general suckiness of WPF.
I will not rest!
I will not give in!
I will not...
Oh look! Something shiny!
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Shiny's good. I like shiny.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Do you have forward resource references? Seems to me that's what that bug is related to.
Forward resource references were already known as a bad idea...
I also saw you used a "StaticResource" in there....depending on where that desired
resource is in your chain of dictionaries, you may need to use DynamicResource.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I also saw you used a "StaticResource" in there....depending on where that desired
resource is in your chain of dictionaries, you may need to use DynamicResource.
I changed it from StaticResource because the IDE complained about me trying to use WPF for production code...
Okay, that was sarcastic - at least the last part was...
I've given up for the day (I feel so... French), and I'm just gonna sit here and stare at my monitor - in some ways, I will remain as productive as I've been all day...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I added this to Buttons.xaml, and the problem is resolved:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
I thought that if the dictionaries were all merged, their content would be magically "found". I guess I'm expecting too much.
CRAP
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Tuesday, May 12, 2009 3:18 PM
|
|
|
|
|
Hi,
I have created a WPF application(browser) having a XamDatagrid. I populated the grid with db values. When i placed the gadget in Windows Sidebar i am unable to see the binded data. And also close, maximize and drag buttons of the sidebar get disappears. Any solution for this will be appreciated. .Thanks in advance
Gomathi R
|
|
|
|
|
Is this a WPF issue or a sidebar gadget implementation issue?
I'm wondering if you'll get more help on a more appropriate message board...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|