|
OK I will try it.
Greetings - Jacek
|
|
|
|
|
I'd pass on this implementation. Too much hard coding of everything.
|
|
|
|
|
Hello!
I have a class:
class MyClass
{
public enum Letters {A,B,C}
public Letters Letter {get;set;}
public bool IsUsed { get; set; }
}
Now, I'd like to bind the Letter property to a Textbox.Text . Works fine, but if a user left the textbox empty, then a parsing error would occur. Instead, in that case I would like to set the IsUsed property to false. I do not want to have a combo box + checkbox, because the enum values are short and well known (like letters) and writing them in a text box is most convenient.
I had tried to bind whole MyClass object and use a converter, but the ConvertBack method didn't have enough data to generate a MyClass object from scratch (there are other members than Letter and IsUsed). I had also tried to pass the original object as a converter parameter but it came out that I cannot bind to ConverterParameter so I am in a dead point.
NOTE: Everything happens in a DataTemplate sandbox for ItemsControl.ItemTemplate , like here:
<DataTemplate x:Key="DataTemplate_Level2">
<TextBox Text="{Binding Path=Letter, Mode=TwoWay}" Width="40" Margin="2" />
</DataTemplate>
How to get it working?
Thanks in advnace
Greetings - Jacek
modified on Saturday, July 30, 2011 4:36 PM
|
|
|
|
|
Making the letter property nullable will fix your paticular issue. But, what if someone types "D"? I would personally use a Selector (like combobox) so the user can choose a valid Letter instead of guessing which letters are valid.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Thanks for answer.
teejayem wrote: Making the letter property nullable will fix your paticular issue.
This would require altering application logic, since the examplary "Letter" property is used in later processing and a new 'null' value would have to be handled. But since it is my own project it is thinkable.
EDIT: No way. It would require too many changes. The enum value is often treated as an integer and sometimes integer arithmetic is used.
teejayem wrote: I would personally use a Selector (like combobox) so the user can choose a valid Letter instead of guessing which letters are valid.
The code which I have posted is purely exmaplary. As I said, actual enum members are known and obvious for a target user. Anyway thanks for a suggestion, I will consider this option.
Greetings - Jacek
|
|
|
|
|
Hi
I have a major problem that is causing me a headache for the last couple of days!
For some reason beyond me my web service isn't working and I am getting the classic error message: "Could not find default endpoint element". My WCF and WPF are in the same solution folder and I am referencing my web service through Service Reference, which generates my app.config. In my WPF I call my web service and pass in via the constructor the name of the end point address. Further, I have copied my app.config to the view layer of my WPF, because my WPF uses MVVM design pattern.
Despite all of this it won't work! Any ideas anyone???
|
|
|
|
|
I had fought with this many times my self. Get firefox. Install firefox and firebug. Use the net tab in firebug to see what is going on.
Did you check the config file of your wpf application? Are the endpoints correct?
Sorry FF may only work with silverlight, not sure about wpf.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I have a listbox which is binded to observable collection e.g main menus.
Using DataTemplate I am adding button to each item in list box.
On double click of button in List box, I want to populate the listbox with submenus collection of selected main menu similar to iphone UI.
As I am new to WPF, can anyone suggest me what should I do to meet my requirement.
Also one more problem which I facing is, if I double click button item, that item is not getting selected in list box.
|
|
|
|
|
Hello,
When I click on a button at UI side, One method is called at serviceside(named Service1).
From service1, an asynchronous call given to another service(named Service2).
At same time, callback is returned to UI from Service1.
But I want to wait till Service2 return data to Service1 and stored into database.
Let me know how to wait in asynchronous call.
Thanks in advance.
--
- Parth Gandhi
|
|
|
|
|
Isn't it just a matter of making the call to Service2 synchronous?
I suppose you could do something like this:
1) create a locked semaphore before your call to Service2
2) call Service2
3) wait on the semaphore
*) when Service2 responds, release the semaphore
|
|
|
|
|
Just call the second service after the first one returns - as simple as that.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Hi
In DatePicker accept only date with "dd/mm/yyyy" and these formats "dmmyy" or "ddmmyy" are not accepted.
i would like to know if there is a way to make the Datepicker to accept also other input format(above).
As it is more easy and quickly for the user to input dates.
Thanks
|
|
|
|
|
Just read you question more closely. If you do not use delimiters then it is not possible to parse the data into a valid date format. If it is an internal convention then I suppose you could trap the editend event and do the parsing there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi thanks for the answer.
I tried with the LostFocus event but when it is fired, the DisplayedDate is already set to Today's date.
For example, if i type "101010" in datepicker, when it loastfocus, as this format is not accepted the selected dae is today date, and therefore the LostFocus event is raised.
Any other idea ??
|
|
|
|
|
use the DateValidationError event and then parse the string
|
|
|
|
|
I don't know why you want the DateTime Picker to accept other input format since what you will need at the end is the selected date. If you want to store the selected date in other format then you can try string formatting to convert the resulting string into the desired format.
|
|
|
|
|
I solved using the DateValidationError event.
Thanks bye
|
|
|
|
|
|
Here have some google foo[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hello guys... I wrote this code to scroll down to bottom automatically in a list whenever a new item is added to it. But it points to second last item not the last one. Here is the code
private void AutoScrollToBottom()
{
if (lstName.Items.Count > 0)
{
lstName.SelectedIndex = lstName.Items.Count - 1;
lstName.UpdateLayout();
lstName.ScrollIntoView(lstName.SelectedIndex);
}
}
Whats wrong with it .... thnx
|
|
|
|
|
I'm surprised that anything happens for you actually, as ScrollIntoView takes and object and not an index. This should work:
object objectToShow = lstName.Items[lstName.Items.Count - 1];
lstName.ScrollIntoView(objectToShow);
|
|
|
|
|
No, this did not work even though I appended lstName.UpdateLayout(); to your answer just b4 ScrollIntoView();.
|
|
|
|
|
Of course it doesn't work . And I bet I know why...
I'm guessing your code looks something like:
private void SomeMethod()
{
AddItem();
AutoScrollToBottom();
}
right?? .
This is one of the things that annoys me about WPF and always throws newbies (sorry if you are not, just this is well known to experienced WPF guys) for a loop.
When you have an item based control (ListBox, ListView, TreeView, etc), items are not really inserted into the control right away. They are inserted at some random point in the future. So what happens is exactly what you are seeing... your code says insert item #10, then it says "scroll to the last item" which still happens to be item #9. Then item #10 happens to be inserted. So you are scrolling to the second to last item because that was really the last item when your code executed.
What you need to do is subscribe to the ItemContainerGenerator.StatusChanged event and wait for the status to be ContainerGenerated on the item you want. Only then can you scroll it into view.
|
|
|
|
|
HI,
I am migrating from RadShceduler control from RadScheduleView for some performance problem. The requirement is to invoke the appointment create event in single click. In scheduler we have the TimeSloteItem which is not in RadScheduleView. I created a control template for timeslotitem and had the inputbindings to invoke the radscheduler appointment create event. I dont know how to achieve this in RadScheduleView. Plz Help... I used the following style..
<br />
<Style x:Key="AllDayTimeSlotStyle" TargetType="{x:Type telerik1:TimeSlotItem}"><br />
<br />
<Setter Property="Template"><br />
<Setter.Value><br />
<ControlTemplate TargetType="{x:Type telerik1:TimeSlotItem}"><br />
<Grid x:Name="LayoutRoot"><br />
<Grid.InputBindings><br />
<MouseBinding MouseAction="LeftClick" Command="commands:SchedulerCustomCommands.CreateAppointment" CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}" /><br />
</Grid.InputBindings><br />
.<br />
.<br />
.<br />
.<br />
.<br />
</ControlTemplate><br />
</Setter.Value><br />
</Setter><br />
</Style><br />
|
|
|
|
|
I find telerik support absolutely excellent for their controls, generally a sample app appears to solve most issues. Have you tried their forums.
Never underestimate the power of human stupidity
RAH
|
|
|
|