|
Mycroft gave you the answer. Effectively, you'll have a checked property in the the VM which you'll bind to from your checkbox. That will be the trigger for the update - although, to be honest, I don't think that using a checkbox to kick off the behaviour you want is the best way forward.
|
|
|
|
|
thanks for tips, I am now successfully able to bind the BlogIsSelected property to the grid checkbox column. but I am not able to acheive following with the code below
1) Show detail grid only when it checkbox is selected
2) attach event to checkbox column, I did not find any click event for this column
Can you please correct the xaml I am using
Thanks
Ankur bhargava
<DataGrid x:Name="FamilyEditorGrid" ItemsSource="{Binding Path=AllBlogs}" MaxHeight="575"
Background="{x:Null}"
Margin="0,0,0,0"
BorderBrush="{x:Null}"
AutoGenerateColumns="False"
SelectionMode="Single"
GridLinesVisibility="None"
RowDetailsTemplate="{StaticResource RowDetailItemTemplate}"
RowDetailsVisibilityMode="{Binding Path=BlogIsSelected, Converter={StaticResource boolToVisibilityConverter}}"
>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</DataGrid.CellStyle>
<!--<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="32" />
</Style>
</DataGrid.RowStyle>-->
<DataGrid.Columns>
<DataGridCheckBoxColumn Header=""
Binding="{Binding Path=BlogIsSelected}"
SortMemberPath="BlogIsSelected" Width="35"
/>
<DataGridTextColumn Header="Blog URL"
Binding="{Binding BlogURL}"
SortMemberPath="BlogURL"
IsReadOnly="True" Width="auto" />
</DataGrid.Columns>
</DataGrid>
|
|
|
|
|
Hello!
I wish to have an icon (Path ) which scales forever until some background operation is finished. I managed to bind a DataTrigger to my dependency property InProgress . However, I want the animation to repeat so I bound RepeatBehavior to InProgress as well. Here I get an exception "'Set property 'System.Windows.FrameworkElement.Style' threw an exception.' Line number '241' and line position '22'.". The inner one is: "Cannot freeze this Storyboard timeline tree for use across threads."
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding InProgress}" Value="True" >
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard AutoReverse="True"
RepeatBehavior="{Binding Path=InProgress, Converter={x:Static Converters:BooleanToRepeatBehaviourConverter.Instance}}" >
<DoubleAnimation To="0.125" Duration="0:0:0.12"
Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleX)" />
<DoubleAnimation To="0.125" Duration="0:0:0.12"
Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleY)" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
The exception started to occur after binding the RepeatBehavior . Before doing that, the animation displayed correctly but only once. Note that I have been using the InProgress property for binding before and it worked. The converter:
public class BooleanToRepeatBehaviourConverter : IValueConverter
{
private static readonly IValueConverter instance = new BooleanToRepeatBehaviourConverter();
public static IValueConverter Instance
{
get { return instance; }
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool) value
? RepeatBehavior.Forever
: new RepeatBehavior(0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
How to solve the problem?
Thanks in advance!
Greetings - Jacek
|
|
|
|
|
Pete's answer:
Pete wrote: The issue is that resources that are in or consumed in a control template have to be frozen. This is done so that the resource can be shared across control instances quickly. Once you set the binding on the Dependency Object on a Freezable, you stop it from being frozen.
As you can't create a static resource of the RepeatBehavior, I'd suggest that this is one of those instances where it is perfectly legitimate to have code in the code behind of the view. Don't tie yourself into logical knots here - view specific code in the view code-behind is legitimate.
Greetings - Jacek
|
|
|
|
|
|
Hi All,
I am a newbie in Silverlight. We are using WCF services and Stored Procs. I would like to implement custom pagination using Datapager(the look and feel) and WCF services. I would like to pull only the required rows from the db. Can this be achieved using just the WCF services and not the WCF RIA services?
I have browsed through the web and learned that it can be achieved in 2 ways
1. WCF RIA services, DomainServices, DomainDataSource
2. Custom Pagination using own controls and not using DataPager.
I dont want to use both of these approaches.
Kindly let me know if there is any other alternative to achieve this using the DataPager and WCF Services.
Thanks a Ton...
|
|
|
|
|
I hate to supply a search for such a well placed question but there seems to be a number of solutions out there based on sql server data paging[^]
What you are describing is paging implemented at the database level rather than the DAL or UI layers. Caveat I have never used paging - ever so my experience is rather limited.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how i can set & get pixel of image in wpf application(C#)?
|
|
|
|
|
|
I need to sort the items in autocompletebox. It has binding to an observable collection of strings.
With a combobox I used the Items.SortDescriptions but this does not work for the ACB.
I tried the following but cant find the listbox property name
//lst = acb1.Template.FindName("SelectionAdapter", acb1) as ListBox;
// if (lst != null)
// lst.Items.SortDescriptions.Add(sd);
So what is the best way to do it please?
|
|
|
|
|
Moonwalker031 wrote: It has binding to an observable collection of strings.
Sort the observablecollection before binding.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well I tried myobscol.orderby(x=>x) but did not work.
I am adding and removing items from the list during execution so would like an automatic sort instead of sorting manually each time.
|
|
|
|
|
You are manipulating the list "manually" when you insert/remove items, why can't you sort it then.
Do some research on sorting observablecollections.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ok solved.
When I searched for sorting Observable collection I read that I had to create another copy of the list which I was trying to avoid.
I inserted the line below after adding items to the list. This should not create unnecessary lists.
acb1.ItemsSource = myobscol.OrderBy(x => x);
Back to the first post. What is the name of the Listbox property in the Autocomplete box? I still need this for somthing else.
ListBox lst = acb1.Template.FindName("SelectionAdapter", acb1) as ListBox;
This does not work and gives a null. I tried "ListBox" and "ItemContainerStyle" but still got a null.
|
|
|
|
|
Rather than manipulating your ObservableCollection, take a look at using CollectionViewSource instead. This provides the ability to sort and filter collection items any which way you want.
|
|
|
|
|
Thanks I came across the CollectionViewSource already. But since my project is almost complete and based on Observable collection I didn't want to change everything.
Anyway now the sorting is solved and working properly (see previous post).
|
|
|
|
|
Hi,
In my application on clicking a link i m opening an aspx page in different IE window.Now I want to display "Loading..." on the parent IE window's status bar untill the new window opens when the link is clicked.
|
|
|
|
|
Try HtmlPage.Window.SetProperty("defaultStatus", "Loading..."); .
However, note this is only for IE.
I'm not sure what you need to do for Firefox or other browsers.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
|
You are welcome. Vote or mark as answered if this answer helped though.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
modified on Tuesday, March 15, 2011 8:05 AM
|
|
|
|
|
I'm curious. Why vote the answer? Surely a better indication would be to mark the answer as SOLVED. That's what these forums are about after all.
|
|
|
|
|
Yes. Fair enough.
'Mark as answered' is still relatively new so I keep forgetting about it.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Abhinav S wrote: 'Mark as answered' is still relatively new so I keep forgetting about it
Fair enough. When you don't ask many questions, but rather spend all your time answering them, it's an easy one to forget.
|
|
|
|
|
I dont know how to use Linq in Silverlight 4.0
I add it into Project.Web but it useless
PLease help me. Thanks
(I dont good at English. But i can read. Thanks )
|
|
|
|
|
You can use LINQ in Silverlight pretty much the same way you use it in C#.
Do you mean LINQ to XML etc?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|