[Solved] how to get one value from a table in the entity framework

Let me give you some direction Do not use a propertie to get your data, use a method like this: //returns an enumeration of users filtered by the given expression Public IEnumerable<User> GetUsers(Expression<Func<User, bool>> expression) { return db.Users.Where(expression); } // returns the first occurency of a user filtered by the given expression Public User GetUser(Expression<Func<User, … Read more

[Solved] how to post string to URL in UWP

You can upload a file with the HttpClient (which replaces the WebClient in UWP) Code: private async Task<string> UploadImage(byte[] file, Uri url) { using (var client = new HttpClient()) { MultipartFormDataContent form = new MultipartFormDataContent(); var content = new StreamContent(new MemoryStream(file)); form.Add(content, “postname”, “filename.jpg”); var response = await client.PostAsync(url, form); return await response.Content.ReadAsStringAsync(); } } … Read more

[Solved] Adding an item to a List which is DataBinded to a DataGrid

Are you adding items to the data bound List<CustomClass> on a background thread? Then you could use the dispatcher to marshall the Add call to back the UI thread: Application.Current.Dispatcher.BeginInvoke(new Action(()=> { yourCollection.Add(yourItem); }))); Do this for all Add and Remove operations that modify the source collection. You should also replace the List<CustomClass> with an … Read more

[Solved] How to use multiple fonts for each combobox item in WPF?

You can implement this easily by using data binding with item template inside comboBox as following: First of all you need to create item template for your ComboBox, which can be done in many ways, Iam going to use the simplest way as following: <ComboBox Width=”200″ Height=”35″ VerticalContentAlignment=”Center” ItemsSource=”{Binding Items}”> <ComboBox.ItemTemplate> <DataTemplate DataType=”{x:Type local:ItemViewModel}”> <StackPanel … Read more

[Solved] Move border-less window. [closed]

In XAML, place this event handler for your window’s MouseDown event: <Window MouseDown=”Window_MouseDown”> … </Window> In the code-behind, place this: private void Window_MouseDown(object sender, MouseButtonEventArgs e) { this.DragMove(); } 1 solved Move border-less window. [closed]

[Solved] Invalid WPF name? [closed]

Because of the space in the middle (after EndNormalBracket) stackPanelOneZeroZeroPercentBasicBuybackStartNormalBracketMotorplusEndNormalBracket StartNormalBracketOneEightZeroOneEndNormalBracketStartNormalBracketUnderwrittenEndNormalBracket here ^ Other than that, there is (technically) nothing wrong with it. 3 solved Invalid WPF name? [closed]

[Solved] SQL db and Combobox [closed]

So here we go. I will help you with such task. First get list of databases. Then get list of tables (parameter is Connection string, where you should add the name of the database you have choosen in your combobox. public List<string> GetDatabaseList() { List<string> list = new List<string>(); string conString = “Data Source=yourDataSource; Integrated … Read more

[Solved] C# WPF ComboBox Auto switch number [closed]

You can add separate properties in your ViewModel and separate ComboBoxes in the view, then manipulate the values when a value changes in the ViewModel, but this is cumbersome, and involves a lot of work when you add a new ComboBox (value). A better approach is to create a custom collection that handles the changes: … Read more

[Solved] Error while saving changes to custom config file [closed]

Requirements using System.Configuration; Read var appSettings = ConfigurationManager.AppSettings; string result = appSettings[key] ?? “Not Found”; Write var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var settings = configFile.AppSettings.Settings; if (settings[key] == null) { settings.Add(key, value); } else { settings[key].Value = value; } configFile.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name); solved Error while saving changes to custom config file [closed]

[Solved] Wait for message delivered to MainWindow sent using SendMessage API

Here is the sample code in C++,(Removed error checking) MainWindow.cpp: #include <windows.h> #include <iostream> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } DWORD WINAPI createyourwindow(LPVOID param) { WNDCLASSEXW wcex = { 0 }; wcex.cbSize = … Read more

[Solved] How to implement a circle button like below one in XAML

Finally got the answer by adding path data <Grid > <Ellipse HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” Stroke=”Black” StrokeThickness=”1″ /> <Path Data=”M10,0 L10,20 z” Stroke=”Black” StrokeThickness=”1″ Stretch=”Fill” /> <Path Data=”M0,10 L20,10 z” Stroke=”Black” StrokeThickness=”1″ Stretch=”Fill” /> </Grid> solved How to implement a circle button like below one in XAML