|
This answer will upset the wpf-purists out there, but when time is money, try this:
Instead of creating a ControlTemplate-Trigger nightmare, reduce the TextBox size with Margin="1" and BorderThickness="0". THEN, place the TextBox inside of Grid tags and place a <rectangle strokethickness="1" stroke="YourColorHere"> in the Grid above TextBox. Example (with binding examples):
<Grid>
<Rectangle Stroke="{Binding CustomBorder}" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
<TextBox Text="{Binding Path=Value}" Margin="1" BorderBrush="Transparent" BorderThickness="0"/>
</Grid>
This code can be injected into a DataTemplate for a GridView or simply in a Window. Adding triggers to a simplified structure will prove easier than trying to override animations dependent on .Net version and operating system. I hate seeing my controls looking different on an XP system vs Win7, so this helps keep my projects looking clean on any display.
Duct-tape solutions aren't always that bad!
|
|
|
|
|
I am using a WCF project in my silverlight 4 project.
At present I have a few settings inside the web.config file of the WCF project which I read from a service file inside the wcf project.
After deployment of this silverlight application, will I be able to see this web.config (Which is inside the wcf project) file and manually update it with new settings so that I do not have to recompile and redeploy each time?
What I mean is:
I know that the web.config file in the web host project can be modified after deployment and there is no need to redploy, etc.
The question is can I make changes in the web.config file which is inside the wcf project without any redeployment? will the service be able to read the new settings in the web.config after it has been manually changed?
Is it possible to manually browse to the wcf web.config file and modify it?
Thanks
|
|
|
|
|
You should be able to edit it, because I have done that before. What you might have to do is to restart the website that the service is running on to make sure that it gets the new settings.
Steve Maier
|
|
|
|
|
Hi arkiboys,
You can change the content of the web.config whatever way you want, provided you have the correct access rights for that.
In order for IIS to take care of the changes, just type iisreset at a command prompt on your web server, and it will reload its configuration.
Hope this helps. Kind regards.
|
|
|
|
|
How do I make my silverlight 4 application (The solution includes silverlight page, wcf project) so that someone in the office can access it?
Thanks
|
|
|
|
|
By deploying it to an IIS server that they can get access to, and properly configuring it.
|
|
|
|
|
Do you want to share your Project with other Programmers ? want to share the source ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I have created a silverlight 4.0 in vs 2010 application as follows:
1-The solution contains the the usual web project for hosting the silverlight app.
2- The solutions also contains a WCF project and the silverilght project with the silverlight pages and the service references to the WCF.
How do I make this so that others can access it please?
Thanks
|
|
|
|
|
You now need to host this application on a web server.
Users can then access this application via the url of the server plus your application.
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.
|
|
|
|
|
You've asked an awful lot of fairly basic questions. Can I suggest that you buy a good book on Silverlight development which will save you an awful lot of effort. I like Silverlight 4 Unleashed[^] and think it would help you immensely.
|
|
|
|
|
|
I'm adding controls to a Grid at runtime:
string SquareName = "square" + Row.ToString() + Col.ToString();
Frame square = new Frame()
{
Name = SquareName
};
Grid.SetRow(square, Row);
Grid.SetColumn(square, Col);
grdBoard.Children.Add(square);
Then later I'm trying to get a reference to the frame:
private Frame _GetFrame(int Row, int Col)
{
string SquareName = "square" + Row.ToString() + Col.ToString();
Frame frame = (Frame)grdBoard.FindName(SquareName);
return frame;
}
It returns null always. The commented code above it also returns null.
As a test I added a button in th XAML. Then I tried this:
Button button = (Button)grdBoard.FindName("cmdTest");
Frame square = (Frame)grdBoard.FindName("square12");
The button was added in the XAML, the frame was added in the code behind at runtime.
Anyone know what I'm doing wrong?
Everything makes sense in someone's mind
modified on Tuesday, December 14, 2010 7:46 PM
|
|
|
|
|
|
Hey all,
I'm new to WPF/Silverlight, which I've noticed is of the sweet goodness.
In a project, I'd like to add a listbox/grid type control that's similar to the Contacts app on the iPhone, as seen in this screenshot[].
ie: it has an A-Z type thing on the side , which when clicked, takes you to the group of items starting w/ that letter.
The goal is to display a potentially "large" # of items in it but still make it easy to find the one you're looking for.
Maybe at the top, it'd have a textbox for autocompletion while typing, and/or a search button, similar to what you get in Blend for searching properties in the Property editor window.
Does anyone know what I mean? I'd be interested in any free or paid 3rd party control which has this or parts of this,so if you know of any, let me know.
If I should roll my own, could you describe the basic layout items? Would it just be a datagrid/dataview type control using a grouping feature, & scrollviewer & a few snippets to move it to items based on clicks, etc?
Any help is appreciated!
|
|
|
|
|
Hmm... two ways I can think of off the top of my head:
1) ListView in the GridView view mode with groups enabled. Then you'd style the items and style the group headers to look like your screen shot.
2) TreeView with the collapse / expand functionality disabled... first level would be A - Z, second level would be the items. Style the first level one way and the 2nd level the other way. Should be easy to disable the collapsing / expanding.
In either case, the A - Z overlay could be done a ton of ways too... vertical stackpanel with TextBlocks (or hyperlinks)... single selection listbox, etc.
No real personal preference between #1 and #2... they both sound like about the same amount of work.
Or you could just use a single listbox and manage inserting and deleting the header items.
|
|
|
|
|
I do not get the datagrid populated with data.
I see in e.result that 10 records are returned.
Can you see why i do not get the datagrid populated please?
Thanks
<Grid x:Name="LayoutRoot" Background="White">
<data:DataGrid Name="gridDetailedMonitor" Margin="5" AutoGenerateColumns="False">
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Key ID" Binding="{Binding KeyID}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="Key Name" Binding="{Binding KeyName}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="myDateTime" Binding="{Binding myDateTime}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="my22DateTime" Binding="{Binding my22DateTime}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="some data" Binding="{Binding somedata}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="somemore field" Binding="{Binding somemorefield}"></data:DataGridTextColumn>
<data:DataGridTextColumn Header="fieldlast" Binding="{Binding fieldlast}"></data:DataGridTextColumn>
</data:DataGrid.Columns>
</data:DataGrid>
</Grid>
|
|
|
|
|
You need to set the ItemSource of the datagrid to a collection (preferably ObservableCollection ) of objects returned from the service.
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.
|
|
|
|
|
|
arkiboys wrote: solved. thank you
You are welcome.
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 have an ObservableCollection of type T - the collection is bound through the ItemsSource to a listbox which shows checkboxes for each item in the collection - the IsChecked property of each checkbox is bound to a bool in type T. How can I do data validation on the ListBox so there is a red border on the listbox if none of the checkboxes are checked and no red border if any of the checkboxes are checked
|
|
|
|
|
I'd use a data trigger for this and draw the border based on the underlying checked property (assuming you are two-way binding to the individual item).
|
|
|
|
|
Is there no way I can do it through data validation? If I have to have all sorts of different techniques depending on the control I would rather just not bother with the built in validation mechanisms.
|
|
|
|
|
RugbyLeague wrote: Is there no way I can do it through data validation?
What validation? Seriously, setting this up is fairly straight forward. Here's a demo of a simple checkbox with a red border that is displayed when the check box (or the value behind it) is checked.
<CheckBox x:Name="chkItem" Margin="5" Content="Check me" IsChecked="{Binding Checked, Converter={StaticResource boolToVis}}, Mode=TwoWay"/>
<Border Margin="3" Background="Red" CornerRadius="5" Padding="5">
<Border.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=chkItem, Path=IsChecked}" Value="False">
<Setter Property="Border.Visibility" Value="Hidden"/>
<Setter Property="Border.Visibility" Value="Hidden"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border> Where Checked returns a boolean value, and is converted using a converter.
|
|
|
|
|
I am probably not explaining myself very well. I don't want red borders around the checkboxes, I want a red border around the listbox hosting them,
|
|
|
|
|
Ah - sorry about that. The principal would be similar, but you could just show the border if the validation results were not empty.
|
|
|
|