|
Personally, I implement INotifyProperty on my models, then reference the models in the client. Then I instruct my WCF service reference to reuse types in all referenced assemblies. So my tiers look something like this:-
public class Employee:INotifyProperty, IDataErrorInfo
{
}
public class EmployeeDataAccess
{
}
IEmployeeService
EmployeeService
public class EmployeeViewModel
{}
public class EmployeeView
{}
Of course the client is a little more complicated than shown as it has a service manager that actually deals with data I/O and acts as a mediator between viewmodels - but that's the gist of it - and it works .
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Let me put that in words I understand!
Your model, originating in the WCF, has the full property declaration and the interface support.
There are no changes to your model (structure and additional interfaces etc) in the client.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No the models are not in the WCF service, they are in their own library. The WCF service has a reference to the model library, and so does the client application. When you create your WCF service reference, you just ensure it reuses the referenced model library (obviously you need to reference the model library before you create the service reference). That way the service proxy is using the same models as the client app, it doesn't make it's own proxy models.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Wayne Gaylard wrote: you just ensure it reuses the referenced model library I knew there would be a catch, this sounds simple but I'll bet there is a bunch of nasty gotchas just waiting to jump out.
You don't by any chance know of a sample set up like this that can be studied do you? And yes I'm asking to snd t codz plz
It's Friday afternoon here so I'm off to a drinking hole, you have defined what I will be doing this weekend!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It would only take me half an hour or so to set something up. Is it alright for me to email a VS 2010 solution to you. If so just drop me an email using the email tag below and let me know your address.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks for the sample app - have a bunch of 5s in appreciation.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks!
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
OtherClass.Subscribe<someclass>(_ => KeepWorking = !KeepWorking);
KeepWorking is a bool
This works fine, but what is Lambda expression _ =>
Best regards
Agha Khan
|
|
|
|
|
MSDN explains Lamda Expressions here[^].
|
|
|
|
|
Hi,
I'm facing a problem to bind a StoryBoard to a label in my WPF application.
My XAML lloks like this:
<Label Height="28" Margin="308,27,250,0" Name="PostingStatusLabel" VerticalAlignment="Top" HorizontalContentAlignment="Left" Foreground="ForestGreen" FontWeight="bold">
<ContentPresenter Content="Posting"></ContentPresenter>
<Label.Triggers>
<DataTrigger Binding="{Binding IsPendingPostExist}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<StringAnimationUsingKeyFrames Storyboard.TargetName="PostingStatusLabel" Storyboard.TargetProperty="(Label.Content)"
RepeatBehavior="Forever" FillBehavior="HoldEnd">
<DiscreteStringKeyFrame Value="Posting" KeyTime="0:0:0.0" />
<DiscreteStringKeyFrame Value="Posting." KeyTime="0:0:0.25" />
<DiscreteStringKeyFrame Value="Posting.." KeyTime="0:0:0.5" />
<DiscreteStringKeyFrame Value="Posting..." KeyTime="0:0:1" />
<DiscreteStringKeyFrame Value="Posting...." KeyTime="0:0:1.25" />
<DiscreteStringKeyFrame Value="Posting....." KeyTime="0:0:1.5" />
<DiscreteStringKeyFrame Value="Posting......" KeyTime="0:0:1.75" />
</StringAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Label.Triggers>
</Label>
When I'm trying to run this application.I get XAMLParseExeption at the start of Label.Triggers tag.
Anyone?
Best regards,
Eli
|
|
|
|
|
You're getting this exception because it's expecting an Event Trigger here, not a data trigger. If you want to use a DataTrigger, you have to apply it to a Style, ControlTemplate or DataTemplate. If I were you, I would create a style something like this:
<Style x:Key="LabelStyle1" TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="contentPresenter"
RepeatBehavior="Forever" FillBehavior="HoldEnd">
<DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="Posting."/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.6" Value="Posting.."/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.9" Value="Posting.."/>
<DiscreteObjectKeyFrame KeyTime="0:0:1.2" Value="Posting..."/>
<DiscreteObjectKeyFrame KeyTime="0:0:1.5" Value="Posting...."/>
<DiscreteObjectKeyFrame KeyTime="0:0:1.8" Value="Posting....."/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsPendingPostExist}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</DataTrigger.EnterActions>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> Then all you need to is define your label like this:
<Label
Content="Posting" HorizontalAlignment="Left"
VerticalAlignment="Top" Foreground="ForestGreen"
Style="{StaticResource LabelStyle1}"/>
|
|
|
|
|
Hi,
Thanks,it is working...
I have one more question:
I'm trying to stop the story board when the trigger is being changed from true to false.
I've set the story board name,and trying to stop it like this:
<Storyboard x:Key="Storyboard1" x:Name="Storyboard1">
.
.
.
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsPendingPostExist}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<StopStoryboard BeginStoryboardName="Storyboard1"/>
</DataTrigger>
</ControlTemplate.Triggers>
but when the trigger switches to false,I receive the following InvalidOperationException:
"Storyboard1 object Name found but it is not a BeginStoryboard object."
Is there something I'm missing?
Thanks again,
Eli
|
|
|
|
|
The reason is, you haven't named the storyboard part you think you have. The key here is that it's BeginStoryboardName - which tells you that you need to apply a name to BeginStoryboard . Add a name to BeginStoryboard , and then use this name in the StopStoryboard .
|
|
|
|
|
Beginners faults...
Thanks a lot..
Best regards,
Eli
|
|
|
|
|
No problem. This is what we're here for - to help.
|
|
|
|
|
+5 for patience and persistence
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Hi All,
I am using the WPF ribbon Library in my application for getting a ribbon control attached in my application.
I need the functionality where I can trap the minimize event in ribbon and do some additional stuff of code in there.
But, to my surprise I could not find any property named Minimized in ribbon .. I could found out collapsed and Expanded but they were of no use.
Can some body tell me what does IsMinimize property correspond to. As,if I know for which property the minimize functionality is attached,I can then easily solve my problem statement.
-Kushagra
I believe in Me !!!
|
|
|
|
|
Hey,
I have in my application(wpf) an Indicator for all Input Boxes, wich indicate if the box is a mandatory field or not, and changes his color if the Field is filled.
Now the product team would like to have this indicator even on radiobuttons, that means the indicator of the radiobutton should know if the others radiobuttons of the same group are filled or not to change the color to the right one.
We have a new requiredradiobutton control wich derive from the Original Control: RadioButton, and i have to programm the Indicator of the control something like that:
protected override void OnChecked(RoutedEventArgs e)
{
RadioButtonGroup myradiobuttonsgroup = this.GetRadioButtonGroup();
foreach(RadionButton rb in myradiobuttonsgroup)
{
if rb.IsChecked != true
rb.Indicator.Status = Status.NotFilled;
else
rb.Indicator.Status = Status.Filled;
}
}
Or Another way how i can handle that without puting the radiobuttons in a listbox or something.
Thanks a lot and Cheers.
Negada
modified 15-Nov-11 3:41am.
|
|
|
|
|
The way I understand it, you want the indicator in the NotFilled state if none of the radio button within the group are checked and the Filled state if at least on of the radio button (within the same group) is checked.
If this is correct, then your code is most likely wrong, this way it will set the indicator status based on the last radio button examined. Do something like
rb.Indicator.Status = myradiobuttongroup.Any(p=>p.IsChecked) ? Status.Filled : Status.NotFilled;
(not tested, may need polishing)
H.
|
|
|
|
|
Hey, thanks for replying, yes u understand it right, i know the code was just an example.. what i really need is how to get the radiogroup of my radiobutton, and if i get the radiogroup how can i get all its radiobuttons..
cheers
modified 15-Nov-11 8:10am.
|
|
|
|
|
There's no RadioButtonGroup in WPF/Silverlight AFAIK. Radio buttons are grouped by either using them in a single common parent element or using the RadioButton.GroupName property.
Mark Salsbery
|
|
|
|
|
Yes that whats i mean, how can i get all radiobuttons of a panel/window with the same groupname?
|
|
|
|
|
Can't you use databinding between the indicators and the Indicator.Status property? That would be the WPF way...
Mark Salsbery
|
|
|
|
|
Mark, i dont need for binding because i programm the logic in the control, anyway changing the indicator status isnt a problem.. what i need is how to find out all the radiobuttons if i have the groupname of one of them.
|
|
|
|
|
Iterate through the Panel.Children collection and check each elements type. If it's one of your radio buttons then check its GroupName property. VisualTreeHelper.GetChild[^] can help...
Mark Salsbery
|
|
|
|