|
How do i bind Canvas.Left -= Math.cos(x) * 125 formula to objects.
x : rotation of rectangle and will increased from 0 to 60 degrees by a storyboard.
<Rectangle x:Name="img1" Canvas.Left="{Binding Converter= {StaticResource PositionConverter1}, ConverterParameter=60}" Canvas.Top="150" Fill="#FF5B5BAF" Stroke="Black" Width="250" Height="250">
<Rectangle.Projection>
<PlaneProjection RotationY="60"/>
</Rectangle.Projection>
</Rectangle>
ConverterParameter=60 must be the RotationY of StoryBoard
|
|
|
|
|
Thanks for reply but how do make ConverterParameter awared of the value changed by StoryBoard
<Storyboard x:Name="sbRotate" AutoReverse="False">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Duration="00:00:01"
Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="60"/>
<EasingDoubleKeyFrame KeyTime="00:00:01" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
here is converter
public class PositionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double currentLeft = (double)value;
double angle = (double)parameter;
return currentLeft -= Math.Cos(angle) * 125;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double currentLeft = (double)value;
double angle = (double)parameter;
return currentLeft += Math.Cos(angle) * 125;
}
}
|
|
|
|
|
You gave me the idea and I solved the problem. Thank you very much Here is the solution for everyone :
DispatcherTimer timer = new DispatcherTimer();
public MainPage()
{
InitializeComponent();
timer.Interval = new TimeSpan(0, 0, 0, 0, 50);
timer.Tick += new EventHandler(timer_Tick);
}
void timer_Tick(object sender, EventArgs e)
{
if (count <= 20)
{
angle = DegreeToRadian(count * 3);
newleft = (1 - (Math.Cos(angle))) * 250;
img1.SetValue(Canvas.LeftProperty, currentleft-newleft-30);
count++;
}
else
{
count = 1;
timer.Stop();
}
}
|
|
|
|
|
I try to describe the scenario :
I’m passing a populated Dictionary<string,string> to the DomainService query to get the filtered data.
The problem is that the data don’t get filtered in proper way if I filter by more than one parameter. The code seems to be correct. I couldn’t realize what can be the problem.
Client Side:
<pre>
Private DomainContext context = new DomainContext();
Private Dictionary<string,string> searchParameters = new Dictionary<string,string>();
Public MainPage()
{
InitializeComponent();
this.searchParameters.Add("ProductCategoryID","3");
this.searchParameters.Add("ProductModelID","1");
this.context.load<Product>(this.context.GetProductQuery(this.searchParameters));
}
Server Side:
Public IQueryable<Product> GetProduct(Dictionary<string, string> searchParameters)
{
IQueryable<Product> queryableData = ObjectContext.Product;
int idValue = 0;
if (searchParameters.ContainsKey("ProductCategoryID"))
{
idValue = int.Parse(searchParameters["ProductCategoryID"]);
queryableData = queryableData.Where(i => i.ProductCategoryID == idValue);
}
if (searchParameters.ContainsKey("ProductModelID "))
{
idValue = int.Parse(searchParameters["ProductModelID"]);
queryableData = queryableData.Where(i => i.ProductModelID == idValue);
}
return queryableData;
}
|
|
|
|
|
Putting a breakpoint i noticed that after the first "Where" there are some entities in "QueryableData" but after executing the second "Where" there are no entities in QueryableData whereas there should be some entities.
|
|
|
|
|
This compiled & runs, but nothing happens when I click a tree node. It works if I do it in XAML, just not in te code behind:
private object _SelectedItem = null;
public object SelectedItem
{
get { return _SelectedItem; }
set
{
if (_SelectedItem != value)
{
_SelectedItem = value;
RaisePropertyChanged("SelectedItem");
itemSelected();
}
}
}
and
RadTreeView tree = new RadTreeView
{
HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
ItemsSource = Clients,
SelectedItem = this.SelectedItem,
Name = "tvwClientProjects"
};
What's wrong with the SelectedItem???
Everything makes sense in someone's mind
|
|
|
|
|
When you do it in the XAML, you are creating a binding... in your C# code you are just copying the value over one time.
You need to do something like:
Binding binding = new Binding("SelectedItem");
binding.Source = this;
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
binding.Mode = BindingMode.TwoWay
SetBinding(RadTreeView.SelectedItemProperty, binding);
P.S. not sure why you are creating the tree in the code behind, but the above will work. There is probably a much cooler way to do what you are trying. You almost never need to create controls in the code behind.
|
|
|
|
|
That did it. Thank you!!!
Everything makes sense in someone's mind
|
|
|
|
|
That's not a binding - you're just setting the property's value.
Maybe something like
RadTreeView tree = new RadTreeView
{
HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
ItemsSource = Clients,
Name = "tvwClientProjects"
};
Binding binding = new Binding("SelectedItem");
binding.Mode = BindingMode.TwoWay;
tree.SetBinding(RadTreeView.SelectedItemProperty, binding);
Mark Salsbery
|
|
|
|
|
Hi,
I am new to the silverlight world, is there any way to set the width of a TextBlock from code behind and call that method in the user controls Intialize method or in load even etc.
I am thinking in the way of asp.net only still, but there is lot of difference. Please help me yaar, I am in desperate need.
Thanks,
Abdul.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
// C#
myTextBlock.Width = 10;
Mark Salsbery
|
|
|
|
|
Hi,
Thanks but that value should depend upon length of the string that comes from the View Model, is that possible.
Or accessing view model properties in code behind, is this possible anything is ok for me now.
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
If you are trying to size to content, don't set the width manually and the control will auto-size. There is a lot more to auto-sizing then just the string length. What about font, font size, font style, fixed width vs. true type, etc?
EDIT: since you mentioned View Model, I assume you are using MVVM. The VM doesn't have access to the View unless you passed it in to the VM using various methods, but thats kind of defeating the whole point.
|
|
|
|
|
SledgeHammer01 wrote: don't set the width manually and the control will auto-size
Exactly this, only a canvas doesn't size automatically, but that control is rarely needed.
It is said that your life flashes before your eyes just before you die. That is true, it's called Life. - Terry Pratchett
|
|
|
|
|
You *could* (but probably shouldn't) use an IValueConverter. You'd bind to the string in the view model and use a converter that returns a width. If, however, you just want the textbox to autosize based on its content, there are better ways of doing that (as the other person mentioned).
Somebody in an online forum wrote: INTJs never really joke. They make a point. The joke is just a gift wrapper.
|
|
|
|
|
Hi All,
in anyways if I could do that or any one could give me some code or a link, it would have been better for me.
Thanks,
Abdul
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi,
I am currently developing in windows form and can display the SSRS reports using the ReportViewer control...
Question:
1- Is it possible to display the SSRS reports via silverlight 4?
2- IS it as same as using the report viewer control as I do in windows forms?
Thanks
|
|
|
|
|
|
As Mark said there is no native report viewer in Silverlight. There is a 3rd party one available but it is expensive and only works with server based reports.
As I need embedded reports (RDLC) so I spawn an ASPX page passing the parameters in the url, while this works it is not satisfactory as the values are exposed and the spawned page just feels flaky. However it does give me a reporting solution in Silverlight, there are some articles on CP that helped.
Silverlight Report Viewer using View Model (MVVM)[^]
Integrate Reporting Services with Silverlight and RIA Services[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Do you mean I can add an .aspx page into my silverlight application and have the report viewer control inside the .aspx page and then call the .aspx from the silverlight page?
|
|
|
|
|
This lives in the VM for my reports dialog
private void doReport(object o)
{
string sReport = o.ToString();
string sURL, sCriteria = string.Empty;
switch (sReport)
{
case"EquipmentList":
sCriteria = GetCriteriaEQ();
break;
case "EquipmentFleet":
sCriteria = GetCriteriaEQFleet();
break;
default:
break;
}
sURL = VML.ReportsVMStatic.GetReportsAddress(sReport, sCriteria);
gUI.ShowWindow(sURL);
AppMessage.DialogCompleted.Send(AppMessage.DialogCompleted.enDialogResult.eTrue);
}
GetCriteria returns a string with the criteria formatted specifically for a report and showwindow openns the aspx page
HtmlPage.Window.Navigate(oURI, "_blank");
The page_load of the aspx deals with the query string and gets the data from the database to service the RDLC. As I said ugly but works.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I studied the link you sent. thanks.
It seems that a new form should be added to the silverlight project which then shows the SSRS report in a popup format?
|
|
|
|
|
Hello,
Is there some control in WPF that i can use to display a list.
For example i have a list of objects where each object have some number of properties.
I wannt to give this list to the control and he will display each object properties in a row when every propertie displayed in a separate column.
So my question is is there some control already in WPF.
If not i will have some how to create one but in order to create i have to know how many properties object has,how can i do it?
Thanks.
|
|
|
|
|
You could use a DataGrid and set AutoGenerateColumns="True" on it. This assumes that all your properties can be displayed textually - if you have images to display, for instance, you are going to have to take over control yourself. WPF can only go so far.
|
|
|
|
|
Check out ListView, it is customizable to some degree (with AutoGenerateColumns=false) and it will probably serve you just fine.
|
|
|
|