|
Glad to help
eli15021979 wrote: Wow...I guess WPF is much more difficult than i thought.
Once you get the hang of it, it becomes second nature, then you will be amazed at what you can accomplish with it.
Good luck.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
I have been searching on the internet for a sample to show me how to show the sql server reporting services (SSRS) reports from a silverlight page i.e. (.xaml)
I have seen where an .aspx file should be used but there is no example on how to use the .aspx page inside or from the .xaml page.
Can you please let me know or point me to a simple site where I can see how to show my SSRS reports from my silverlight application?
Thanks
|
|
|
|
|
|
Thank you for the link which I had seen before.
What I would liek to find out is that in this link which you sent, where do I add the /RpDemoWebForm.aspx webform?
Is it added to the host which has a default.aspx or o the silverlight project?
Thanks
|
|
|
|
|
I have added mine in a folder in the web project (where the default.aspx lives. In that folder I have all the bits required to get the data and the .rdlc files with the viewer aspx
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I have a stack panel which has grid to show footer buttons. This grid has some column definitions with some fixed width and with * as well. In Star columns I am having Grids again with some coulmn definitions in which I am placing the buttons. These columna are some fixed width, auto. In auto columns I am placing buttons.
My problem here is when I resizing and minimizing my browser some buttons are becoming invisible. It seems the columns are over written one another.
Is there any way that I can make the buttons stretch and make them not over written by the other columns?
Thanks for the help.
Following the xaml for the control
<Grid x:Name="LayoutRoot">
<StackPanel Orientation="Vertical">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" Visibility="{Binding DataPublishingVisible,Converter={StaticResource visibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Content="Import"
Visibility="{Binding Button_Import.Visibility}"
IsEnabled="{Binding Button_Import.Enabled}"
command:Click.Command="{Binding Button_Import.Command}" />
<Button
Grid.Column="2"
Content="Export"
Visibility="{Binding Button_Export.Visibility}"
IsEnabled="{Binding Button_Export.Enabled}"
command:Click.Command="{Binding Button_Export.Command}" />
<Button
Grid.Column="4"
Content="Publish"
Visibility="{Binding Button_Publish.Visibility}"
IsEnabled="{Binding Button_Publish.Enabled}"
command:Click.Command="{Binding Button_Publish.Command}" />
<Button
Grid.Column="6"
Content="Cancel"
Visibility="{Binding Button_Cancel.Visibility}"
IsEnabled="{Binding Button_Cancel.Enabled}"
command:Click.Command="{Binding Button_Cancel.Command}" />
<Button
Grid.Column="8"
Content="Save"
Visibility="{Binding Button_Save.Visibility}"
IsEnabled="{Binding Button_Save.Enabled}"
command:Click.Command="{Binding Button_Save.Command}" />
</Grid>
<Grid Grid.Column="3" Visibility="{Binding ListVisible,Converter={StaticResource visibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Content="Preview Work Distribution"
Visibility="{Binding Button_Preview.Visibility}"
IsEnabled="{Binding Button_Preview.Enabled}"
command:Click.Command="{Binding Button_Preview.Command}" />
<Rectangle Grid.Column="1" Width="20" Visibility="{Binding Button_Preview.Visibility}" />
<Button
Grid.Column="2"
Content="New"
Visibility="{Binding Button_New.Visibility}"
IsEnabled="{Binding Button_New.Enabled}"
command:Click.Command="{Binding Button_New.Command}" />
<Button
Grid.Column="3"
Content="Delete"
Margin="5,0"
Visibility="{Binding Button_Delete.Visibility}"
IsEnabled="{Binding Button_Delete.Enabled}"
command:Click.Command="{Binding Button_Delete.Command}" />
<Button
Grid.Column="4"
Content="Edit"
Visibility="{Binding Button_Edit.Visibility}"
command:Click.Command="{Binding Button_Edit.Command}" />
</Grid>
<Grid Grid.Column="5" Visibility="{Binding DataEntryVisible,Converter={StaticResource visibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="1"
Content="Clear All"
Visibility="{Binding Button_Clear.Visibility}"
IsEnabled="{Binding Button_Clear.Enabled}"
command:Click.Command="{Binding Button_Clear.Command}" />
<Button
Grid.Column="3"
Content="Cancel"
Visibility="{Binding Button_Cancel.Visibility}"
IsEnabled="{Binding Button_Cancel.Enabled}"
command:Click.Command="{Binding Button_Cancel.Command}" />
<Button
Grid.Column="5"
Content="Save"
Visibility="{Binding Button_Save.Visibility}"
IsEnabled="{Binding Button_Save.Enabled}"
command:Click.Command="{Binding Button_Save.Command}" />
</Grid>
<Grid Grid.Column="7" Visibility="{Binding GenericVisible,Converter={StaticResource visibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="1"
Content="Clear All"
Visibility="{Binding Button_Clear.Visibility}"
IsEnabled="{Binding Button_Clear.Enabled}"
command:Click.Command="{Binding Button_Clear.Command}" />
<Button
Grid.Column="5"
Content="Save"
Visibility="{Binding Button_Save.Visibility}"
IsEnabled="{Binding Button_Save.Enabled}"
command:Click.Command="{Binding Button_Save.Command}" />
</Grid>
<Grid Grid.Column="9" Visibility="{Binding TestVisible,Converter={StaticResource visibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="1"
Content="Back"
Visibility="{Binding Button_Back.Visibility}"
IsEnabled="{Binding Button_Back.Enabled}"
command:Click.Command="{Binding Button_Back.Command}" />
</Grid>
</Grid>
</StackPanel>
</Grid>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 11-Nov-11 14:48pm.
|
|
|
|
|
Can you post some simplified XAML that demonstrates your issue explicitly (so we don't have to guess what you mean exactly)?
Somebody in an online forum wrote: INTJs never really joke. They make a point. The joke is just a gift wrapper.
|
|
|
|
|
Hi,
I got the fix for this problem, Grid columns over write on one another, the best way is to create the columns to fit all the elements in the column.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi,
I want to hide all the controls in a column in my WPF application.
Note - I dont want to hide column, I want to hide its contents only.
Please help me.
|
|
|
|
|
Where are the columns ? Are they on a DataGrid, ListView or normal Grid ?
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
|
Then I think that you are going to have to create a boolean property in your codebehind/viewmodel, and bind each control to this property. Then whenever you want to show or hide your controls you can just set the property accordingly.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks You very much . but i am new to wpf can you tell me how can i bind control to property.
|
|
|
|
|
You should do something like this:-
Fisrt of all create a Boolean property in your code behind that you can bind to(ensure your code file uses the INotifyProperty Interface[^] and your property setter raises the PropertyChanged event)
Then declare the Converter that will set your control's Visibility property to Hidden if your boolean property is true like this:
<Grid.Resources>
<BooleanToVisibilityConverter x:Key="HiddenConverter" />
</Grid.Resources>
Then in your XAML you bind the control's Visibility property to the boolean property, declaring the Converter property to use the HiddenConverter set up previously.
<Label Grid.Column="1" Content="Label1" Visibility="{Binding Path=ShowControls, Converter={StaticResource HiddenConverter}" Margin="3"/>
Then whenever you change the state of your boolean property, the control will be shown/hidden appropriately
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Why not just create a Visibility property? that way you don't need the converter... unless you are using the bool elsewhere, of course .
|
|
|
|
|
ı try to Use 1 Storyboard and more than 1 Button on Web Site.
1 Storyboard in UserControl.Resources
<UserControl.Resources>
<!--
<Storyboard x:Name="myStoryboard">
<!--
<DoubleAnimation
Storyboard.TargetName="myDropShadowEffect"
Storyboard.TargetProperty="ShadowDepth"
To="30" Duration="0:0:0.5"
AutoReverse="True" />
<!--
<DoubleAnimation
Storyboard.TargetName="myDropShadowEffect"
Storyboard.TargetProperty="BlurRadius"
To="10" Duration="0:0:0.5"
AutoReverse="True" />
<DoubleAnimation
Storyboard.TargetName="myScaleTransform"
Storyboard.TargetProperty="ScaleX"
To="1.5" Duration="0:0:0.5"
AutoReverse="True" />
<DoubleAnimation
Storyboard.TargetName="myScaleTransform"
Storyboard.TargetProperty="ScaleY"
To="1.5" Duration="0:0:0.5"
AutoReverse="True" />
<DoubleAnimation
Storyboard.TargetName="myTranslateTransform"
Storyboard.TargetProperty="X"
To="-30" Duration="0:0:0.5"
AutoReverse="True" />
<DoubleAnimation
Storyboard.TargetName="myTranslateTransform"
Storyboard.TargetProperty="Y"
To="-30" Duration="0:0:0.5"
AutoReverse="True" />
<!--
<!--
<!--
<!--
</Storyboard>
</UserControl.Resources>
And The Button Controll in The grid Layout
<Button Content="Click!" Click="StartAnimation" Width="200" Margin="20,6.25,16,7.625" Grid.Row="2" d:LayoutOverrides="VerticalAlignment, VerticalMargin" Style="{StaticResource ButtonStyle1}">
<Button.Effect>
<DropShadowEffect x:Name="myDropShadowEffect" />
</Button.Effect>
<Button.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="myTranslateTransform" />
<ScaleTransform x:Name="myScaleTransform" />
</TransformGroup>
</Button.RenderTransform>
</Button>
Code Behind:
//button1
private void StartAnimation(object sender, RoutedEventArgs args)
{
myStoryboard.Begin();
}
The 1 Button Action Work Well
for same actions to another buttons ı coppy storyboard renamed to equal it to button name is work
Here is The Question? for each button ı wrıte same Storyboard just name diferent do ı must use this method or there is better solution(Tick&Tricks) is it Possible To Use 1 Storyboard And 2 or More Button Use Same Storyoard I ask this Because ı Dont Want make large .xap thx
|
|
|
|
|
For my application I need to have different context menus for different text boxes. One of the features I wanted to add to the context menu was the ability to add words to a custom dictionary as the application will be used in a technical field where a lot of words won't be in a standard dictionary. I found a snippet of code online that showed how to do this, however it is in C# and uses a lambda expression that I'm having a very hard time converting. The specific line of code I'm having trouble with is this:
mnuAddToDictionary.Click += (object o, RoutedEventArgs rea) =>
{
this.AddToDictionary(this.txtEdit.SelectedText);
};
mnuAddToDictionary is a menu item and AddToDictionary is the method that actually does work of adding the selected misspelled word to the custom dictionary.
The AddToDictionary method is set up thus:
Public Sub AddToDictionary(ByVal entry as string)
End Sub
The closest I was able to get was AddHandler AddToDictionary.Click, AddressOf AddToDictionary , however I'm getting an error message because the delegate and the method do not have the same signature.
I pretty new to WPF and I'm not familiar with lambda expression yet because I never needed them. Any help would be greatly appreciated as I'm at a loss of what to do now. Any help would be greatly appreciated and thanks in advance.
|
|
|
|
|
The Click handler has to have a signature of object, RoutedEventArgs. You'd have to have an intermediate function with that signature that then calls your AddToDictionary function. Probably why they used a lambda . Vb.net supports lambdas too. I don't know vb.net very well, but I think the syntax is something like:
mnuAddToDictionary.Click = Sub(o, e)
AddToDictionary(txtEdit.SelectedText)
End Sub
Or you can just point it to an intermediate function as I said.
|
|
|
|
|
I was trying something along those lines however when I try to create the lambda expression I get this error message:
Public Event Click(sender As Object, e As System.Windows.RoutedEventArgs) is an event, and cannot be called directly. Use a
That's why I was trying to use the AddHandler method because I can't figure out how to hook into the Click event. I think the lambda expression is correct because I don't get any error messages (although I had to change the 'e' to 'rea' because the variable 'e' hides in an enclosing block.
I think I will go with the immediate function but if someone can explain how I can hook into the click event I would appreciate it since that seems to be a neater why to do it over using an intermediate function. Thanks!
|
|
|
|
|
Actually though I think there might be a problem with the intermediate function. I have several text boxes that have this custom context menu so I created a independent function. When you right-click on any of these text boxes, they call this function which know by the sender parameter which text box called it. In that function is where the AddToDictionary menu item is added. If I use AddHandle mnuAddToDictionary, AddressOf AddEntryToDictionary , then when the user clicks on 'Add To Dictionary' how does the AddEntryToDictionary method know which text box the context menu is being currently displayed on? I was thinking I could use a public variable to save the current text box, but I don't think that is a very efficient way.
|
|
|
|
|
Okay...so I finally figured out how to do it. It is actually a combination of the AddHandler method and a lambda expression. The line of code that worked was:
AddHandler AddToDictionary.Click, Sub()
AddEntryToDictionary(selectedText)
End Sub
Originally I was trying to use sender.SelectedText where sender was a ByRef parameter that was the text box that was calling this method, however ByRef parameters apparently can't be used in lambda expressions so I had to do add this line Dim selectedText As String = sender.SelectedText just before the AddHandler line.
Hope this helps others.
|
|
|
|
|
Hi,
Can I set HorizontalContentAlignment=Left and still stretch the contentcontrol to max remaining width of the browser?
Can nybody please help me in this?
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi All,
How can we make contentcontrol aligned left and stretched to the max of the remaining browser size.
Let us suppose I have a content control in which there are few other user controls are loaded. Now can I make the content control to stretch full remaining browser size and still the user control in it be left aligned.
When I make the content control left aligned, the user control is stretching within small area. If I make the control control center aligned, the user control stretching very well to the max size of the remaining size, but coming the center.
Is there any way to stretch it and still remaining as left alignment?
I am really in need please help me. Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 8-Nov-11 20:03pm.
|
|
|
|
|
indian143 wrote: stretched to the max of the remaining browser size.
Using "*" in the layout width or height usually does this for you.
|
|
|
|
|
Hi,
Eventhough, ContentControl is not stretching. It stretches when I put its HorizantalContentAlignment property set to stretch, but its content is displayed in the center. This is solving problem of one form but destroying the layout of all the other forms.
So I have to keep HorizantalContentAlignment=Left and HorizantalContentAlignment=Left and still I want the content control to be streched to the max width of the remaining in the browser.
I tried in the following way by using code behind, no way its listening to me. ContentControl is a stubborn control it looks . It doesnt listen to what developers says and but developers have to listen to it . Sorry for my words, but really I am frustrated .
Remember here the actual width of the column in the grid is coming perfectly matching, and I am trying to set the width of the content control to that width. Still content control is not setting its width to the width to which I am setting to.
May be I am wrong, please advice me if you find any issues in my xaml or code behind. I requesting thanks a lot in advance.
Following is the xaml
<UserControl x:Class="Huron.UI.Healthcare.Configuration.Common.TaskWorkContainerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:regions="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism"
xmlns:local="clr-namespace:Huron.UI.Healthcare.Configuration.Common"
DataContext="{Binding TaskWorkContainer,Source={StaticResource ConfigSupportViewModelLocator}}">
<Grid ScrollViewer.HorizontalScrollBarVisibility="Auto" ShowGridLines="True" x:Name="parentGrid">
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition x:Name="grid" MinWidth="744" Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Canvas Grid.Row="0" Grid.Column="1" >
<local:TaskWorkContainerHeaderView
Grid.Row="0" Grid.Column="1"
DataContext="{Binding Path=FormHeader}"
VerticalAlignment="Top" />
</Canvas>
<ContentControl Background="Purple" x:Name="parentContentControl"
Margin="0,15,0,0"
Grid.Row="1" Grid.Column="1"
regions:RegionManager.RegionName="{Binding FormData.FormBodyRegionName}"
regions:RegionManager.RegionContext="{Binding FormData}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Left"
HorizontalAlignment="Stretch"
SizeChanged="Content_SizeChanged"/>
<Canvas Grid.Row="2" Grid.Column="1" >
<local:TaskWorkContainerFooterView
Grid.Row="2" Grid.Column="1"
DataContext="{Binding Path=FormFooter}"
Visibility="{Binding Path=FooterVisibility}"
VerticalAlignment="Bottom" />
</Canvas>
</Grid>
</UserControl>
Following is the code behind
void Content_SizeChanged(object sender, SizeChangedEventArgs e)
{
double minWidthOfParent;
if ((parentGrid.ColumnDefinitions[1].MinWidth == null) || (parentGrid.ActualWidth==null))
{
minWidthOfParent = 744;
}
else
{
minWidthOfParent = parentGrid.ColumnDefinitions[1].ActualWidth;
}
parentContentControl.MinWidth = minWidthOfParent;
parentContentControl.Width = minWidthOfParent;
}
Thanks,
Abdul.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 9-Nov-11 13:26pm.
|
|
|
|