|
Not sure where the coordinates will come from, but let's assume it will be a dependency property on your custom button. You can then programmatically bind to that property from your menu. There will be a dependency property on your menu that the binding is set to update. You can then bind to that property from the textbox so that the canvas coordinates get updated. You can also update the visibility of the textbox using an IValueConverter that converts a bool (another dependency property linked between the button and menu) to a visibility value.
Not sure I understood your question correctly, but hopefully those ideas will help you get a start.
|
|
|
|
|
Hi , I am getting below error when try to run the VS2003 application.
---------------------------
Microsoft Development Environment
---------------------------
Error while trying to run project: Unable to start debugging on the web server. Server side-error occurred on sending debug HTTP request.
Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start Without Debugging. You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation.
---------------------------
OK Help
---------------------------
- Ajay K
|
|
|
|
|
Well, as WPF/Silverlight don't run in VS2003, how is this related to this forum?
|
|
|
|
|
You need Visual Studio 2005 (at least) for WPF and Visual Studio 2008 for Silverlight.
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.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hello,
Whenever I try getting the size of a custom control (inside the code), both ActualWidth/Height and DesiredSize returns either Size(0, 0) or Size(Width, Double.NaN) or Size(Width, Double.PositiveInfinity). Same with Height/Width.
Any suggestions?
Thanks,
Theo
|
|
|
|
|
Hi Theo,
Are you trying to get the size of the control from inside the control. I mean inside control's
ArrangeOverride or do you want to get the control's size in application level?
|
|
|
|
|
I'm struggling to identify the correct way to move from one control to another using MVVM. I have implemented the navigation framework and MVVMLight. UserVM is the viewmodel and it is a static property the ViewModelLocator
public static UserDetailsVM UserDetailsVMStatic
{
get
{
if (_UserDetailsVM == null)
{
CreateUserDetailsVM();
}
return _UserDetailsVM;
}
}
So I have a control with a list of users in a datagrid, the user clicks on the hyperlinkbutton and navigates to the details form. The ID is correctly passed via the navigation but I'm not using it yet as I expect to use the existing VM.
The details control binds to the static VM and should show the selected user details from the datagid control (this works within the same page).
This control binding does not return the selected user details but the FIRST users details.
DataContext="{Binding UserDetailsVMStatic, Source={StaticResource Locator}}"
The textbox binding should show the user details of the selected user from the list page
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding EditableUserDetails.Email, Mode=TwoWay}"/>
Except I already have a VM created to service the datagrid control and it has the selected item in a property.
How can I use the existing VM in the details form.
Do I have to chase through the staticresource dictionary to get the VM from the locator or is there a way to do this in XAML.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So the question turned out to be wrong.
What I wanted to do was use the same viewmodel to service the 2 views. This was achieved by binding both views to the STATIC viewmodel in the viewmodellocator.
This can be done either code behind or xaml
public NTFXPastCash()
{
InitializeComponent();
this.Layoutroot.DataContext = ViewModels.ViewModelLocator.NTFXPastCashVMStatic;
}
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello.
I create a UseControl and i'd like to add an collection DependencyProperty.
<br />
......<br />
private static DependencyPropertyKey ItemsPropertyKey = <br />
DependencyProperty.RegisterReadOnly("MyItems",<br />
typeof(List<TextBlock>), typeof(AutoCompleteTextBox),<br />
new FrameworkPropertyMetadata(new List<TextBlock>(), MyListChanged)<br />
);<br />
<br />
static void MyListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)<br />
{<br />
}<br />
<br />
public List<TextBlock> MyItems<br />
{<br />
get { return (List<TextBlock>)GetValue(FileNameProperty); }<br />
set { SetValue(FileNameProperty, value); }<br />
}<br />
.........<br />
How can I do the same with a collection of string and not of TextBlock?
thanks
|
|
|
|
|
What is the problem with List<string> ?
AFAIK, You can create a DependencyProperty of any type. Just change the Type of List<textblock> to List<string>
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
The problem is that when I set the dependencyProperty on XAML I do something like:
<br />
<MyControlsNameSpace:MyControl.MyItems> <br><br />
<TextBlock Text="First Item" /> <br><br />
<TextBlock Text="Second Item" /> <br><br />
</MyControlsNameSpace:MyControl.MyItems><br />
But if I have a List of string I don't know How to set this property
Thanks
|
|
|
|
|
Well my friend, why don't you use ItemsControl in this regard.
You can go for ListBox.
<ListBox ItemsSource="{Binding}" DataContext="{StaticResource MyItems}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding MyProperty}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
If you are using List of STRING you dont need to specify property name. Use Text="{Binding}" which will eventually call ToString for the string object and get the value of it.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Hello
I'm not so good in wpf.
If I understand well you say that I have to change my property type to ItemsControl intead of String and add a ListBox with that XAML on my custom control.
Is it correct?
|
|
|
|
|
Yes you are in right path.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Hi,
I would like to add to my RichEditBox's ToolBar buttons that can switch language (and change direction), like in Word (maybe it is supported only with bi-language windows).
This feature is supported automatically by RichEditBox (and EditBox) and if I use the Alt+Shift I can switch language without any problem, question is how to implement a button that do this?
Logically I think there should have been an EditingCommand for this operation, but I couldn't find one.
Any idea (or better, sample code)?
Thanks,
Yariv
Here is an image showing the buttons I'm talking about:Image
|
|
|
|
|
Hello,
My application connects to sql server database and displays data...
In some of the tables in sql server, the data can be updated via other applications in the company...
In my silvelight application, how is it possible to update the UI controls everytime the data in the database is changed?
I guess I am after some kind of synchronization between the UI and the data on the database.
Any thoughts please?
Thanks
|
|
|
|
|
You need to periodically calling the service to check if data has changed and then update the UI (that should happen automatically provided INotify and Data binding have been properly implemented).
Another approach could be to use the Silverlight duplex communication channel[^]. This allows the service to tell the UI that something has changed and the UI needs to be refreshed.
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.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I am in Silverlight and I want to determine which key was pressed by the user - and potentially refuse it.
The keydown event returns two events that seem to be useless. The Key property is missing most punctuation marks. The PlatformKeyCode only gives good character codes for capital letters and numbers. Punctuation and the 10-key pad don't work.
I've also tried the TextInput events. These do let you see the text of the key that was pressed, but it seems that by the time these events are called, it is too late to cancel the key stroke.
Have I missed something? or is just one of those things that can't be done in Silverlight?
Brent
Brent
|
|
|
|
|
Try KeyUp.
Purely my observation , but it works better than KeyDown in many cases.
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.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
KeyUp is essentially identical to KeyDown except for when the event is triggered. There is still no way to tell that the user pressed the period, question mark, etc. keys.
Brent
|
|
|
|
|
Can this [^]thread be of any assistance to you?
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.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I read this and all of the side posts before posting my question. I read it again. It seems that Microsoft can't understand why anyone would need to type in something besides letters and numbers - or try to prevent a user from typing any garbage they want. I suppose that is too heavy for a silverlight application.
I was just hoping someone here had come up with a work-around.
Brent
Brent
|
|
|
|
|
hi
I am binding label through
<Label Content="{Binding Path=OrderDetails.OrderPaymentId}" FontSize="20">
now i want if the value of OrderDetails.OrderPaymentId=0
then the visibility of label become collapsed
please help how to do this using style or trigger
|
|
|
|
|
You need to create a value converter class, and bind the Visibility property to it in your xaml.
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
<Label.Style>
<Style>
<Style.Triggers>
<DataTrigger
Binding="{Binding Path=OrdeDetails.OrderPaymentId}" Value="0">
<Setter Property="Label.Visibility" Value="Collapsed"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
|
|
|
|